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

Sylvain Lebresne updated CASSANDRA-4759:
----------------------------------------

    Attachment: 4759.txt

Seems like the fix for CASSANDRA-4716 didn't fix the whole problem. The 
(hopefully) last problem is in the handling of the compositeType 
'end-of-component'. Namely, ReversedType don't apply to that eoc so we should 
take that into account. Patch attached to fix (the patch is against 1.1 because 
this does affect 1.1). It also fixes CASSANDRA-4760 (because that was in fact 
the same problem).
                
> CQL3 Predicate logic bug when using composite columns
> -----------------------------------------------------
>
>                 Key: CASSANDRA-4759
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4759
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: T Jake Luciani
>            Assignee: Sylvain Lebresne
>         Attachments: 4759.txt
>
>
> Looks like a predicate logic bug that only happens when you have > 2 primary 
> keys and use COMPACT STORAGE (meaning its using composite columns under the 
> hood)
> First I'll show it works with just 2 
> {code}
> cqlsh:dev> CREATE TABLE testrev (
>        ...          key text,
>        ...          rdate timestamp,
>        ...          num double,
>        ...          PRIMARY KEY(key,rdate)
>        ...          ) WITH COMPACT STORAGE
>        ...            AND CLUSTERING ORDER BY(rdate DESC);
> cqlsh:dev> INSERT INTO testrev(key,rdate,num) VALUES 
> ('foo','2012-01-01',10.5);
> cqlsh:dev> select * from testrev where key='foo' and rdate > '2012-01-01';
> cqlsh:dev> select * from testrev where key='foo' and rdate >= '2012-01-01';
>  key | rdate                    | num
> -----+--------------------------+------
>  foo | 2012-01-01 00:00:00-0500 | 10.5
> {code}
> Now we create with 3 parts to the PRIMARY KEY
> {code}
> cqlsh:dev> drop TABLE testrev ;
> cqlsh:dev> CREATE TABLE testrev (
>        ...          key text,
>        ...          rdate timestamp,
>        ...          rdate2 timestamp,
>        ...          num double,
>        ...          PRIMARY KEY(key,rdate,rdate2)
>        ...          ) WITH COMPACT STORAGE
>        ...          AND CLUSTERING ORDER BY(rdate DESC);
> cqlsh:dev> INSERT INTO testrev(key,rdate,rdate2,num) VALUES 
> ('foo','2012-01-01','2012-01-01',10.5);
> cqlsh:dev> select * from testrev where key='foo' and rdate > '2012-01-01';
>  key | rdate                    | rdate2                   | num
> -----+--------------------------+--------------------------+------
>  foo | 2012-01-01 00:00:00-0500 | 2012-01-01 00:00:00-0500 | 10.5
> cqlsh:dev> select * from testrev where key='foo' and rdate >= '2012-01-01';
> {code}
> The last query should return the row...

--
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

Reply via email to