You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Andrew Grosser (Jira)" <ji...@apache.org> on 2025/07/31 19:16:00 UTC

[jira] [Created] (CASSANDRA-20808) OR is not working on SAI indexes

Andrew Grosser created CASSANDRA-20808:
------------------------------------------

             Summary: OR is not working on SAI indexes
                 Key: CASSANDRA-20808
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20808
             Project: Apache Cassandra
          Issue Type: Bug
            Reporter: Andrew Grosser


For 5.0.4 (current) release. It seems the sai indexes are off?

 

Example:

```

cqlsh:sfpla> create index on test(y) using 'sai';
cqlsh:sfpla> create table test(x timeuuid primary key);
cqlsh:sfpla> select * from test where y=982c4900-3256-11ef-9772-1e1480865e16 or y=982c4900-3256-11ef-9772-1e1480865e16;
SyntaxException: line 1:64 no viable alternative at input 'or' (...from test where y=982c4900-3256-11ef-9772-1e1480865e16 [or]...)

```

 

Docs report his is possible:

https://cassandra.apache.org/doc/latest/cassandra/developing/cql/indexing/sai/sai-query.html

```
This example uses the following table and indexes:
 {{CREATE TABLE IF NOT EXISTS cycling.comments_vs (
  record_id timeuuid,  id uuid,
  commenter text,  comment text,
  comment_vector VECTOR <FLOAT, 5>,
  created_at timestamp,
  PRIMARY KEY (id, created_at)
)WITH CLUSTERING ORDER BY (created_at DESC);CREATE INDEX commenter_idx    ON cycling.comments_vs (commenter)    USING 'sai';CREATE INDEX created_at_idx    ON cycling.comments_vs (created_at)    USING 'sai';CREATE INDEX ann_index    ON cycling.comments_vs (comment_vector)    USING 'sai';}}
Several indexes are created for the table to demonstrate how to query for matches on more than one column.
Query for a match on either one column or the other:
 * Query

 * Result
 {{SELECT * FROM cycling.comments_vs
    WHERE
    created_at='2017-03-21 21:11:09.999000+0000'
    OR created_at='2017-03-22 01:16:59.001000+0000';}}
{{```}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org