You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Brett Snyder (JIRA)" <ji...@apache.org> on 2016/12/03 18:03:59 UTC

[jira] [Commented] (CASSANDRA-10271) ORDER BY should allow skipping equality-restricted clustering columns

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

Brett Snyder commented on CASSANDRA-10271:
------------------------------------------

No, I just got sidetracked from getting back at it until today.  Attached is a new patch for 3.x.  Let me know what other modifications it may need.  It now supports the other query patterns you and Tyler mentioned earlier in the thread.

I do get one test failure after making the changes in the other existing unit tests in SelectOrderByTest.

java.lang.AssertionError: Query should be invalid but no error was thrown. Query is: SELECT v FROM %s WHERE k = 0 ORDER BY k DESC (values: [])

Wasn't sure if that condition should be removed or if my changes go a bit too far and are not restrictive enough to prevent that.

Thanks!

> ORDER BY should allow skipping equality-restricted clustering columns
> ---------------------------------------------------------------------
>
>                 Key: CASSANDRA-10271
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10271
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>            Reporter: Tyler Hobbs
>            Assignee: Brett Snyder
>            Priority: Minor
>             Fix For: 3.x
>
>         Attachments: 10271-3.x.txt, cassandra-2.2-10271.txt
>
>
> Given a table like the following:
> {noformat}
> CREATE TABLE foo (a int, b int, c int, d int, PRIMARY KEY (a, b, c));
> {noformat}
> We should support a query like this:
> {noformat}
> SELECT * FROM foo WHERE a = 0 AND b = 0 ORDER BY c ASC;
> {noformat}
> Currently, this results in the following error:
> {noformat}
> [Invalid query] message="Order by currently only support the ordering of columns following their declared order in the PRIMARY KEY"
> {noformat}
> However, since {{b}} is restricted by an equality restriction, we shouldn't require it to be present in the {{ORDER BY}} clause.
> As a workaround, you can use this query instead:
> {noformat}
> SELECT * FROM foo WHERE a = 0 AND b = 0 ORDER BY b ASC, c ASC;
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)