Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Normal
Description
CASSANDRA-11196 accidentally broke reading from tables with mixed clustering column order in the opposite direction.
ReversedPrimaryKeyRestrictions::boundsAsComposites method attempts to reverse the list returned from PrimaryKeyRestrictionSet::boundsAsComposites and fails, as Guava’s Lists::transform method returns a List that doesn’t support set().
Reproduction:
CREATE TABLE test.test ( a int, b int, c int, PRIMARY KEY (a, b, c) ) WITH CLUSTERING ORDER BY (b ASC, c DESC); SELECT * FROM test.test WHERE a = 0 AND (b, c) > (0, 0) ORDER BY b DESC, c ASC; > ServerError: java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException: null
at java.util.AbstractList.set(AbstractList.java:132) ~[na:1.8.0_181]
at java.util.Collections.swap(Collections.java:497) ~[na:1.8.0_181]
at java.util.Collections.reverse(Collections.java:378) ~[na:1.8.0_181]
at org.apache.cassandra.cql3.restrictions.ReversedPrimaryKeyRestrictions.boundsAsComposites(ReversedPrimaryKeyRestrictions.java:63) ~[main/:na]
at org.apache.cassandra.cql3.restrictions.StatementRestrictions.getClusteringColumnsBoundsAsComposites(StatementRestrictions.java:580) ~[main/:na]
at org.apache.cassandra.cql3.statements.SelectStatement.makeFilter(SelectStatement.java:418) ~[main/:na]
at org.apache.cassandra.cql3.statements.SelectStatement.getSliceCommands(SelectStatement.java:359) ~[main/:na]
at org.apache.cassandra.cql3.statements.SelectStatement.getPageableCommand(SelectStatement.java:191) ~[main/:na]
at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:172) ~[main/:na]