1

I am trying to learn cassandra. I am using windows community edition (2.0).

My table schema is:

CREATE TABLE test.TestTable2 (
PK1 int,
PK2 int,
CK3 int,
CK4 int,
Dump text,
PRIMARY KEY ((PK1,PK2,CK3),CK4)
);

I want to query the dump value for (PK1=1 and Pk2 =2 and Ck3 =5 and CK4 in (4,5)) or (PK1=2 and Pk2 =2 and Ck3 =5 and CK4 in (4,5)). I am unable to use or condition , can someone suggest how can I do that in CQL

M.javid
  • 6,387
  • 3
  • 41
  • 56
Rajesh Gaur
  • 287
  • 5
  • 11

1 Answers1

1

There is no support for OR operator: what you'd like to do is hit 2 partitions so it must be done by two different queries.

Query 1: (PK1=1 and Pk2 =2 and Ck3 =5 and CK4 in (4,5)) 
Query 2: (PK1=2 and Pk2 =2 and Ck3 =5 and CK4 in (4,5))

You can implement the "short circuit" by yourself: perform at first the query you'd expect to have bigger possibilities to retrieve the result -- If you got the result stop your process, if not perform second query.

Carlo Bertuccini
  • 19,615
  • 3
  • 28
  • 39