Cassandra query on 2 dates

64 views Asked by At

Can we run a query like...

Date1 BETWEEN (range1, range2) AND Date2 BETWEEN(range3, range4)

From what I gather this is not Cassandra's Forte.

Can it be achieved with Spark SQL and Cassandra?

1

There are 1 answers

1
Knight71 On

In cassandra range query can be performed only on clustering key. So If you have a schema where DATE1 is clustering key you can do range query.

eg:

 CREATE TABLE foo_table (
 userid text,
 period timestamp,
 data text,
 PRIMARY KEY((customer),period)

);

select * from foo_table where userid='user1' and period >= '2000-01-10'