cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrés de la Peña (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-10271) ORDER BY should allow skipping equality-restricted clustering columns
Date Wed, 12 Jul 2017 09:22:01 GMT

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

Andrés de la Peña commented on CASSANDRA-10271:
-----------------------------------------------

Here are new versions of the patch addressing the comments:

||[3.11|https://github.com/apache/cassandra/compare/cassandra-3.11...adelapena:10271-3.11]||[trunk|https://github.com/apache/cassandra/compare/trunk...adelapena:10271-trunk]||

The validation is made with {{StatementRestrictions#isColumnRestrictedByEq}}, exactly as it
is suggested by [~blerer]. I have also overridden [{{MultiColumnRestriction.EQRestriction#isEQ}}|https://github.com/adelapena/cassandra/blob/889b95d7a7e9a0152d34cba87fcd2fe42c5c3414/src/java/org/apache/cassandra/cql3/restrictions/MultiColumnRestriction.java#L139-L143]
to accept queries like these:
{code}
SELECT * FROM foo WHERE a = 0 AND (b, c) = (0, 0) ORDER BY c;
SELECT * FROM foo WHERE a = 0 AND (b, c) IN ((0, 0)) ORDER BY c;
{code}

The unit test is adapted to the desired behaviour and it uses {{assertInvalidMessage}} instead
of {{assertInvalid}}.

I ran the patch on our internal CI. There are not failures for the unit tests and the failing
dtests seem not related to the change.

> 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: Andrés de la Peña
>            Priority: Minor
>             Fix For: 3.11.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.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message