Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Duplicate
-
None
-
None
-
Low
Description
Because the GT/GTE/LT/LTE operators generate Slice restrictions, when the index is on a clustering column and a range predicate is used, restrictions are not allowed on any following, non-indexed clustering columns.
cqlsh> create table ks.t1 (k text, c1 int, c2 int, c3 int, v text, primary key (k,c1,c2,c3)); cqlsh> create custom index on ks.t1(c2) using 'org.apache.cassandra.index.sasi.SASIIndex'; cqlsh> select * from ks.t1 where c1 = 1 and c2 > 0 allow filtering; k | c1 | c2 | c3 | v ---+----+----+----+----- a | 1 | 1 | 1 | val (1 rows) cqlsh> select * from ks.t3 where c1 = 1 and c2 > 0 and c3 = 1 allow filtering; InvalidRequest: code=2200 [Invalid query] message="PRIMARY KEY column "c3" cannot be restricted (preceding column "c2" is restricted by a non-EQ relation)"
Given that ALLOW FILTERING is required and we're querying via the index, it's probably reasonable to expect this second query to be allowed.