Repository navigation
Conversation
Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
run each optimization type on its own, on a table with two unindexed fragments, and verify its effect on the number of fragments and on the number of unindexed rows. note: pruning only removes versions older than a week, so it is verified to keep the recent versions. Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
add the IVF_SQ, IVF_RQ and IVF_HNSW_FLAT vector index types and the FM scalar index type, so that every index type supported by LanceDB can be created through the C API. Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
@galsalomon66 would appriciate your feedback! |
There was a problem hiding this comment.
🟡 Changes recommended
The expanded statistics structure can overwrite memory for existing C callers, while unvalidated mode values at the FFI boundary can cause undefined behavior.
3 open issues
What changed in this PR
This PR expands the LanceDB C bindings to give callers more control over index maintenance and visibility into rebuild progress.
Changes:
- Adds reindex modes, index selection, atomic transaction properties, and progress callbacks.
- Extends index statistics and supports additional vector and scalar index types.
- Adds tests, documentation, and an example of the reindexing workflow.
| File | Description |
|---|---|
valgrind.supp |
Refines thread-allocation suppressions and adds Rayon coverage. |
tests/test_vector_index.cpp |
Tests vector index types, reindex modes, options, and statistics. |
tests/test_index.cpp |
Tests scalar reindexing, transaction properties, and progress reporting. |
tests/test_common.h |
Adds a thread-safe progress recorder for tests. |
src/table.rs |
Adds transaction-property retrieval and shared output-array handling. |
src/index.rs |
Implements reindex options, callbacks, new index types, and extended statistics. |
include/lancedb.h |
Exposes and documents the new C APIs and types. |
examples/full.cpp |
Demonstrates selective reindexing and transaction-property retrieval. |
examples/external_provider/Cargo.lock |
Records new binding dependencies for the example. |
docs/index.rst |
Documents reindex modes, progress reporting, and maintenance guidance. |
Cargo.toml |
Adds JSON parsing and asynchronous trait dependencies. |
Cargo.lock |
Records the new direct dependencies. |
Review effort: Balanced
lancedb_table_index_stats() now also reports: - the index type - the number of fragments covered and not covered by the index - the number of rows deleted from the indexed fragments - the number of partitions of a vector index - the table version the newest index segment was built against Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
add lancedb_table_optimize_indices(), which brings the indices of a table up to date with explicit options: - the reindex mode: let lance decide (default), append a delta segment, merge segments, or retrain - the number of segments to merge - the names of the indices to optimize - transaction properties to store with the commit Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
add lancedb_table_get_transaction_properties(), which returns the key-value pairs that were stored with the commit of a table version, for example by lancedb_table_optimize_indices(). this allows finding which job made a commit. Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
add an optional callback to the options of lancedb_table_optimize_indices(), which is called when a stage of building an index starts, advances and completes. this allows following a reindex of a large table. Signed-off-by: Yuval Lifshitz <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
8fce024 to
1c8d120
Compare
Xuanwo
left a comment
There was a problem hiding this comment.
Expanding LanceDBIndexStats in place under lancedb_table_index_stats is fine. Please add a short note to the PR description or docs that existing C/C++ callers must recompile against the new header before using the updated library, since the structure layout and size change under the same symbol.
| LanceDBReindexMode::Retrain => OptimizeOptions::retrain(), | ||
| }; | ||
|
|
||
| if opts.num_index_names > 0 { |
There was a problem hiding this comment.
With a non-NULL index_names and num_index_names == 0, this branch is skipped and OptimizeOptions keeps index_names = None, which Lance interprets as every index. A caller that computes a selection and ends with zero names therefore gets the full set: RETRAIN retrains all vector indices, and other modes can merge or append across every index, commit a new table version, and store the transaction properties. The SDK treats Some(empty) as an empty selection and returns before the commit, and the header only defines NULL as "all indices"; this combination is currently accepted without an error.
|
#86 landed on Please preserve the raw integer inputs and checked conversions when merging The public header also conflicts around the index declarations. Please retain the read-only index listing API from #90 alongside the rebuild statistics changes here. |


this work should enable better control over the reindexing process: