cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-10271) ORDER BY should allow skipping equality-restricted clustering columns
Date Mon, 29 Aug 2016 13:08:21 GMT

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

Benjamin Lerer commented on CASSANDRA-10271:
--------------------------------------------

[~bsnyder788] CASSANDRA-10707 has been committed.
The code now convert {{IN}} restrictions with only one element into {{EQ}} restrictions. By
consequence, you can simply use the {{SelectStatement::isColumnRestrictedByEq}} method. It
is use for the {{GROUP BY}} clause [here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java#L1071].

> 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: 2.2.x, 3.x
>
>         Attachments: 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)

Mime
View raw message