Aleksey Yeschenko created CASSANDRA-14899:
---------------------------------------------

             Summary: 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
             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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to