[
https://issues.apache.org/jira/browse/CASSANDRA-14899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16693303#comment-16693303
]
Alex Petrov commented on CASSANDRA-14899:
-----------------------------------------
+1 with two minor optional nits for your consideration:
* {{ArrayList -> List}}
[here|https://github.com/iamaleksey/cassandra/commit/29b7f064d69aff55123dcfc282c3c44ab733734f#diff-f2feb48017f94269b5fbb96ee38b5816R204]
* you can short-circuit
[here|https://github.com/iamaleksey/cassandra/commit/29b7f064d69aff55123dcfc282c3c44ab733734f#diff-f2feb48017f94269b5fbb96ee38b5816R199]
If you think these modifications are unnecessary, please feel free to commit
as-is.
> Cannot perform slice reads in reverse direction against tables with
> clustering columns in mixed order
> -----------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-14899
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14899
> Project: Cassandra
> Issue Type: Bug
> Components: CQL
> Reporter: Aleksey Yeschenko
> Assignee: Aleksey Yeschenko
> Priority: Major
> Fix For: 2.2.x
>
>
> 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:
> {code}
> 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
> {code}
> {code}
> 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]
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]