Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11399

Unable to run range queries on SASI clustering index with restrictions on succeeding columns

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Low
    • Resolution: Duplicate
    • Fix Version/s: None
    • Component/s: Feature/SASI
    • Labels:
      None
    • Severity:
      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              samt Sam Tunnicliffe
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: