You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2013/06/20 13:08:21 UTC

[jira] [Updated] (CASSANDRA-5666) CQL3 should not allow ranges on the partition key without the token() method, even for byte ordered partitioner.

     [ https://issues.apache.org/jira/browse/CASSANDRA-5666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-5666:
----------------------------------------

    Attachment: 5666.txt

Attached trivial patch for this (that include update of the documentation).

Just to illustrate the problem we currently have, consider (where BytesOrderingPartitioner is used):
{noformat}
cqlsh:ks> CREATE TABLE test ( k int PRIMARY KEY);
cqlsh:ks> INSERT INTO test(k) VALUES (1);
cqlsh:ks> INSERT INTO test(k) VALUES (0);
cqlsh:ks> INSERT INTO test(k) VALUES (-1);
cqlsh:ks> SELECT * FROM test;

 k
----
  0
  1
 -1

cqlsh:ks> SELECT * FROM test WHERE k >= -1 AND k < 1;
Bad Request: Start key must sort before (or equal to) finish key in your partitioner!

{noformat}
                
> CQL3 should not allow ranges on the partition key without the token() method, even for byte ordered partitioner.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5666
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5666
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 1.2.6
>
>         Attachments: 5666.txt
>
>
> When the partition is an ordered one, CQL3 currently allows non-equal conditions on the partition key directly. I.e. we allow
> {noformat}
> CREATE TABLE t (k timeuuid PRIMARY KEY);
> SELECT * FROM t WHERE k > ... AND k < ...;
> {noformat}
> but this is a bug because even ordered partitioner don't order following the type of the partition key. They order by bytes, always.
> So that type of query doesn't do in general what it is supposed to do and we should disallow it. Even for ordered partitioner, the token() function should be used. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira