cassandra - Slicing over partition rows using tuple operation in CQL -


i trying understand behavior of tuple operator clustering keys. here trying do:

create table sampletable (a int,b int,c int, d int, e int, primary key((a,b,c),d,e)); insert sampletable(a,b,c,d,e) values(1,1,1,1,1); insert sampletable(a,b,c,d,e) values(1,1,1,1,1); insert sampletable(a,b,c,d,e) values(1,1,1,1,2); insert sampletable(a,b,c,d,e) values(1,1,2,1,1); insert sampletable(a,b,c,d,e) values(1,1,2,1,2); insert sampletable(a,b,c,d,e) values(1,1,2,2,3); insert sampletable(a,b,c,d,e) values(1,1,2,1,2);  insert sampletable(a,b,c,d,e) values(1,1,1,2,3);  cqlsh:mapro> select * sampletable;   | b | c | d | e ---+---+---+---+---  1 | 1 | 1 | 1 | 1  1 | 1 | 1 | 1 | 2  1 | 1 | 1 | 2 | 3  1 | 1 | 2 | 1 | 1  1 | 1 | 2 | 1 | 2  1 | 1 | 2 | 2 | 3  (6 rows)  -- query1 cqlsh:mapro> select * sampletable a=1 , b=1 , c in (1,2) , (d,e)<(2,3);    | b | c | d | e                                                                  ---+---+---+---+---                                                                  1 | 1 | 1 | 1 | 1                                                                   1 | 1 | 1 | 1 | 2                                                                   1 | 1 | 2 | 1 | 1                                                                   1 | 1 | 2 | 1 | 2                                                                                                                                               (4 rows)               -- query2 cqlsh:mapro> select * sampletable a=1 , b=1 , c in (1,2) , (d,e)<(2,9);                                                    | b | c | d | e                                                                  ---+---+---+---+---                                                                  1 | 1 | 1 | 1 | 1                                                                   1 | 1 | 1 | 1 | 2                                                                   1 | 1 | 1 | 2 | 3                                                                   1 | 1 | 2 | 1 | 1                                                                   1 | 1 | 2 | 1 | 2                                                                   1 | 1 | 2 | 2 | 3                                                                                                                                               (6 rows) 

i not able understand why query 2 returning different results compared query 1. understanding cassandra apply partition key filtering first , tries apply tuple ordering i.e. (d,e)<(2,3) applied d<2 , on top of results apply e<3. wrong in understanding? please help.

in case of clustering columns, (a1, a2) < (b1, b2) can true in 1 of following cases:

1) a1 < b1  2) a1=b1 , a2 < b2 

this how cassandra internally ordering based on clustering columns

based on this, results of query 1 , 2 per expectation.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -