[jira] [Commented] (CASSANDRA-14899) Cannot perform slice reads in reverse direction against tables with clustering columns in mixed order

2018-11-20 Thread Aleksey Yeschenko (JIRA)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-14899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16693379#comment-16693379
 ] 

Aleksey Yeschenko commented on CASSANDRA-14899:
---

Committed as 
[cf6f7920f7742bb9a17a23ad37499d9213807d81|https://github.com/apache/cassandra/commit/cf6f7920f7742bb9a17a23ad37499d9213807d81]
 to 2.2, and merged upwards (just the unit tests bit). Cheers.

> 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.14
>
>
> 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



[jira] [Commented] (CASSANDRA-14899) Cannot perform slice reads in reverse direction against tables with clustering columns in mixed order

2018-11-20 Thread Alex Petrov (JIRA)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-14899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-14899) Cannot perform slice reads in reverse direction against tables with clustering columns in mixed order

2018-11-16 Thread Aleksey Yeschenko (JIRA)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-14899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16689343#comment-16689343
 ] 

Aleksey Yeschenko commented on CASSANDRA-14899:
---

Code [here|https://github.com/iamaleksey/cassandra/commits/14899-2.2], CI 
[here|https://circleci.com/workflow-run/b6db8bff-2aa2-49e7-8a8e-d01079c85872].

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