mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 00:20:47 +00:00
Libraries such as CassIO, LangChain, and LlamaIndex create vector indexes using Cassandra's StorageAttachedIndex (SAI) class name. This commit lets ScyllaDB accept these statements without modification. When a CREATE CUSTOM INDEX statement specifies an SAI class name on a vector column, ScyllaDB automatically rewrites it to the native vector_index implementation. Accepted class names (case-insensitive): - org.apache.cassandra.index.sai.StorageAttachedIndex - StorageAttachedIndex - sai SAI on non-vector columns is rejected with a clear error directing users to a secondary index instead. The SAI detection and rewriting logic is extracted into a dedicated static function (maybe_rewrite_sai_to_vector_index) to keep the already-long validate_while_executing method manageable. Multi-column (local index) targets and nonexistent columns are skipped with continue — the former are treated as filtering columns by vector_index::check_target(), and the latter are caught later by vector_index::validate(). Tests that exercise features common to both backends (basic creation, similarity_function, IF NOT EXISTS, bad options, etc.) now use the SAI class name with the skip_on_scylla_vnodes fixture so they run against both ScyllaDB and Cassandra. ScyllaDB-specific tests continue to use USING 'vector_index' with scylla_only.