cassandra - Does CQL3 support nested AND and OR -


given sample table schema:

create table foo (  pk1 text,  pk2 text,  pk3 text,  pk4 text,  data map<text, text>,  primary key ((pk1, pk2, pk3), pk4) ); 

i wonder if possible have query selects different combinations of pk2, pk3, pk4 fixed pk1. like:

select * foo pk1 = 'abc' ,  ((pk2 = 'x' , pk3 = 'y' , pk4 = 'z') or ((pk2 = 'd' , pk3 = 'e' , pk4 = 'f')); 

i don't working. have set of pk2, pk3, pk4 tuples , fixed pk1 , want select matching rows using single query if possible (cassandra 2.2.x).

i wonder if possible have query selects different combinations of pk2, pk3, pk4 fixed pk1.

no, not.

as doan pointed out, or not supported (yet). leaves and makes nesting where conditions superfluous.

also, adding parens around and parts not supported either. without parens works, not them:

aploetz@cqlsh:stackoverflow> select * row_historical_game_outcome_data customer_id=123123 , (game_id=673 , game_time = '2015-07-01 05:01:42+0000');  syntaxexception: <errormessage code=2000 [syntax error in cql query] message="line 1:89 missing ')' @ 'and' (...=123123 , (game_id=673 [and] game_time...)"> 

that being said, in predicate work on either last partition or last clustering key. using on partition key considered anti-pattern. in case, in case work (syntactically):

select * foo pk1 = 'abc' , pk2 = 'x' , pk3 = 'y' , pk4 in ('z','f'); 

Comments