vector_search: test: migrate vector_index_with_additional_filtering_column to Python

Move the SCYLLADB-635 regression test from C++ vector_store_client_test
to Python test_vector_search_with_vector_store_mock.

The test creates a vector index on (embedding, ck1) and verifies that
SELECT with ANN ordering works correctly when additional filtering
columns are included in the index definition.
This commit is contained in:
Karol Nowacki
2026-04-27 09:33:10 +00:00
parent 5a8af3c727
commit 0bb7e47090
2 changed files with 18 additions and 15 deletions

View File

@@ -166,3 +166,21 @@ def test_vector_search_cql_error_contains_http_error_description(cql, test_keysp
with pytest.raises(InvalidRequest, match="404.*index does not exist"):
cql.execute(
f"SELECT * FROM {table} ORDER BY embedding ANN OF [0.1, 0.2, 0.3] LIMIT 5")
# Create a vector index with an additional filtering column.
# Because the local secondary index logic was used to determine the index target column,
# the implementation wrongly selects last column as the target(vectors) column, leading to
# an exception on the SELECT query:
# ANN ordering by vector requires the column to be indexed using 'vector_index'.
# Reproduces SCYLLADB-635.
def test_vector_search_vector_index_with_additional_filtering_column(cql, test_keyspace, vector_store_mock, skip_without_tablets):
schema = "pk1 tinyint, pk2 tinyint, ck1 tinyint, ck2 tinyint, embedding vector<float, 3>, PRIMARY KEY ((pk1, pk2), ck1, ck2)"
with new_test_table(cql, test_keyspace, schema) as table:
cql.execute(
f"CREATE CUSTOM INDEX ON {table}(embedding, ck1) USING 'vector_index'")
cql.execute(
f"SELECT * FROM {table} ORDER BY embedding ANN OF [0.1, 0.2, 0.3] LIMIT 5")

View File

@@ -1206,21 +1206,6 @@ SEASTAR_TEST_CASE(vector_store_client_abort_due_to_query_timeout) {
}));
}
// Create a vector index with an additional filtering column.
// Because the local secondary index logic was used to determine the index target column,
// the implementation wrongly selects last column as the target(vectors) column, leading to an exception
// on the SELECT query:
// ANN ordering by vector requires the column to be indexed using 'vector_index'.
// Reproduces SCYLLADB-635.
SEASTAR_TEST_CASE(vector_store_client_vector_index_with_additional_filtering_column) {
co_await do_with_vector_store_mock([](cql_test_env& env, vs_mock_server&) -> future<> {
// Create a vector index on the embedding column, including ck1 for filtered ANN search support.
co_await env.execute_cql("CREATE CUSTOM INDEX idx ON ks.test (embedding, ck1) USING 'vector_index'");
BOOST_CHECK_NO_THROW(co_await env.execute_cql("SELECT * FROM ks.test ORDER BY embedding ANN OF [0.1, 0.2, 0.3] LIMIT 5;"));
});
}
SEASTAR_TEST_CASE(vector_store_client_local_vector_index) {
co_await do_with_vector_store_mock([](cql_test_env& env, vs_mock_server&) -> future<> {
// Create a local vector index on the 'embedding' column.