11

I'm trying to do something like this in CQL:

SELECT address FROM Person WHERE age= 20 or age= 25  

But Cassandra doesn't support the OR operator and I can't use IN(20, 25) either, because age isn't a primary key. Is there any way to solve this ?

Thanks in advance.

Aaron
  • 55,518
  • 11
  • 116
  • 132
user2090879
  • 683
  • 2
  • 10
  • 16

2 Answers2

9

You can do this with

SELECT address FROM Person WHERE age IN ( 20, 25 )

  • 2
    my understanding is Cassandra only supports IN on partition key columns: http://www.datastax.com/dev/blog/a-deep-look-to-the-cql-where-clause – Tamar Dec 28 '16 at 11:36
6

You will have to perform the disjunction client-side, or use an analytical tool like Hive or Pig.

jbellis
  • 19,347
  • 2
  • 38
  • 47