[
https://issues.apache.org/jira/browse/CASSANDRA-10271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14942440#comment-14942440
]
Benjamin Lerer commented on CASSANDRA-10271:
--------------------------------------------
Thanks for the new patch.
Your patch does not seem to handle cases like:
* {{SELECT * FROM %s WHERE a=? AND b=? AND c >= ? ORDER BY c ASC}}
* {{SELECT * FROM %s WHERE a=? AND b=? AND c IN (?, ?) ORDER BY c ASC}}
* {{SELECT * FROM %s WHERE a=? AND b=? AND (c , d) > (?, ?) ORDER BY c ASC, d
ASC}}
You should also add some unit tests for post-ordering. For queries like:
* {{SELECT * FROM %s WHERE a IN (?, ?) AND b=? ORDER BY c ASC}}
* {{SELECT * FROM %s WHERE a IN (?, ?) AND b=? AND c >= ? ORDER BY c ASC}}
{quote}
Wasn't really sure the best way to approach restricting to an IN restriction
with only one value.
{quote}
{{SingleColumnRestriction}} and {{MultiColumnRestriction}} support 2 types of
{{IN}} restrictions: with values (e.g. {{b IN (?, ?, ?)}}) and with marker
(e.g. {{IN ?}}). In the case of {{IN}} with values you can check the number of
terms.
> 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: Bug
> Components: API, Core
> Reporter: Tyler Hobbs
> Assignee: Brett Snyder
> Priority: Minor
> Fix For: 3.x, 2.2.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)