william
william

Reputation: 23

How to do multiget in CQL3 for composite row key?

CF schema:

CREATE TABLE mytable (
upperId int,
lowerId int,
hour timestamp,
counter text,
succ int,
fail int,
PRIMARY KEY ((upperId, lowerId), hour, counter));

each record is keyed by composite id upperId:lowerid, how can I do multiget with CQL3?

This is not valid:

select * from mytable where (upperid, lowerid) in ((10000, 1), (10000, 2), (20000, 1));

I can't do this either:

select * from mytable where (upperid = 10000 and lowerid in (1, 2)) or (upperid = 20000 and lowerid = 1);

I got error: missing EOF at ')'.

Please help point to effective way to do multiget for composite row key in CQL3.

Thanks, William

Upvotes: 1

Views: 356

Answers (1)

BrianC
BrianC

Reputation: 10721

CQL does not yet support a logical "or" in select statements.

Instead, in your application your could combine the result sets from the two queries:

select * from mytable where upperid = 10000 and lowerid in (1, 2);
select * from mytable where upperid = 20000 and lowerid = 1;

Reference:

Upvotes: 1

Related Questions