Sam Tunnicliffe created CASSANDRA-11399:
-------------------------------------------

             Summary: Unable to run range queries on SASI clustering index with 
restrictions on succeeding columns
                 Key: CASSANDRA-11399
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11399
             Project: Cassandra
          Issue Type: Bug
          Components: sasi
            Reporter: Sam Tunnicliffe
            Priority: Minor


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. 

{code}
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)"
{code}

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.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to