vector-store: implement local vector indexes based on nonpk columns#517
Draft
ewienik wants to merge 16 commits into
Draft
vector-store: implement local vector indexes based on nonpk columns#517ewienik wants to merge 16 commits into
ewienik wants to merge 16 commits into
Conversation
In table module there exist similar names: partition_key_count and partition_key_columns - the first is for partition key for a table, second is for partition key of the index. Let's rename the first to better name its purpose.
This commit adds new enum DbIndexedValue::Filtering(CqlValue) to distinguish the third type of indexed value (vector, document, filtering). It implements also retrieving filtering columns values from DbIndexedRow::values - after the target value is taken. This commit refactors table::Column to support insert/remove methods. These methods cannot be combined as we need to check the CqlValue enum type before inserting. For this reason the intermediate list of column values is Box<[(Timestamp, Option<CqlValue>)]> instead of Box<[Timestamped<CqlValue>]> - for easier handling upserting/deletion of values. This commit refactors ColumnVec::update to check timestamp before updating.
…ations This commit adds DbIndexedOperation struct to distinguish two types of operations on a single db row: Upsert or Delete. It refactors DbIndexedRow::values as operation: DbIndexedOperation. Using such operations we can refactor TableAdd trait into TableModify with two methods: upsert and delete. With previous implementation it was hard to understand if we delete a row or only update with no values. It refactors Table::add into two methods - upsert and delete and provides a common function update_index. It refactors monitor_items::add function into two - upsert and delete and provides a common function process_operations.
This commit adds unit tests for split_values_filtering to check valid value or tombstone value and values with filtering. This commit adds a unit test to check if table properly upsert/delete filtering column. This commit adds unit test to validate monitor_items process DbIndexedOperation::Delete.
This commit extend fullscan select to support retrieving filtering columns:
SELECT {primary_key_list}, (column-1) writetime(column-1), .. FROM {keyspace}.{table}
This commit refactors db_index::range_scan_stream by adding parse_values and
parse_primary_key functions. Parsing filtering columns is done in chunks of two
values from db row.
…lues This commit refactors db_cdc to use only information about primary_key from CDC table. If the operation is DELETE it sends primary_key to the monitor_items to delete. If the operation is UPSERT it concurrently queries db for current target and filtering columns values. There is a limit for concurrency setup as 3 * num_workers. This commit adds retrieval of filtering column values - it adds supporting functions to the db_index_backend.
This commit enables filtering using HTTP API, so it allows filtering by CQL queries.
…ry-key columns This commit adds single ann_filter_filtering_columns_int_eq integration test. It tests if filtering by filtering columns is working. It doesn't test other types of restrictions as they are tested with filtering using primary key columns. This commit refactors creating db store for integration tests to support filtering columns.
This commit adds two tests - one for global indexes, second for local indexes - that check if filtering by additional filtering columns provided in the index definition is working. This commit refactors also tests in create_index group to support test new functionality.
It seems that this test is unreliable - sometimes ck values can be mixed in cdc or fullscan. This commit refactors the test to check possible values for ck.
Currently, primary_key_columns is taken from db_index. As this data is needed to calculate non-pk index partition key this commit put it into IndexMetadata for easier maintenance. This commit removes unneeded DbIndex::GetPrimaryKeyColumns message.
This commit refactors IndexMetadata and adds a new field partition_key_count to be aligned with primary_key_columns - as this value describes the partition_key part in primary_key_columns. This commit removes unneeded DbIndex::GetPartitionKeyCount message.
This commit adds support for nonpk partition key columns in local vector indexes by passing such column values using DbIndexedOperation::Upsert(Box<[DbIndexedValue]>) - the first are values for DbIndexedValue::Vector() or DbIndexedValue(Document) - target values to build index. The second are values for nonpk partition key column. The third are filtering values. The PartitionKey for Index is built in table module - from values coming in DbIndexedRow. db_index and db_cdc actors retrieve additional data during fullscan or query after CDC. Table is responsible for synchronizing data incoming from fullscan or cdc (data coming from monitor_items). This commit fixes parsing index options to support all possible table columns. Tests are prepared in following commits.
It seems that preparing available_columns in table module is unnecessary, as available columns are checked in httproutes.
This commit updates flow test to check all possible combination of local vector indexes keys: partition keys, clustering keys, regular keys.
This commit introduces validator tests for creating local indexes based on clustering or regular columns. It adds tests for supporting such indexes in cdc and for testing filtering on such indexes.
Collaborator
Author
|
Changelog for 7e4ad48
range diff |
ewienik
force-pushed
the
vector-721-local-nonpk-indexes
branch
from
July 16, 2026 11:15
7b754ac to
7e4ad48
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for nonpk partition key columns in local vector indexes. The solution is based on passing such column values using DbIndexedOperation::Upsert(Box<[DbIndexedValue]>) - the first are values for DbIndexedValue::Vector() or DbIndexedValue(Document) - target values to build index. The second are values for nonpk partition key column. The third are filtering values.
The PartitionKey for Index is built in table module - from values coming in DbIndexedRow. db_index and db_cdc actors retrieve additional data during fullscan or query after CDC. Table is responsible for synchronizing data incoming from fullscan or cdc (data coming from monitor_items).
This PR contains also refactor of IndexMetadata - to store primary_key_columns and partion_key_count (instead of calling for them from db_index actor).
This PR adds unit tests and validator e2e tests for new functionality.
This PR is based on #501 (last 6 commits are valid)
Fixes: VECTOR-721