Skip to content

index: add prewarm API for named indices - #83

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/expose-table-prewarm-index
Nov 21, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/expose-table-prewarm-index

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 21, 2026

Copy link
Copy Markdown
Member

Expose the SDK's Table::prewarm_index(name) through the C ABI, so a caller built on lancedb-c can load a named index into the cache before the first query.

lancedb_table_prewarm_index(table, index_name, error_message) returns LANCEDB_SUCCESS on success, LANCEDB_INDEX_NOT_FOUND when the table has no index with that name, and the mapped SDK error otherwise; a null or non-UTF-8 name is LANCEDB_INVALID_ARGUMENT. Like lancedb_table_drop_index, the call borrows the table handle and the name, so no ownership crosses the boundary and no existing entry point changes.

The operation exists unchanged in the pinned lancedb 0.33 and in 0.42.0-beta.21, and both the local (Dataset::prewarm_index) and the remote path report IndexNotFound for an unknown name, so the error mapping holds before and after #78. The change is independent of #74: it only adds a new function, and rich index listing, index statistics and index creation options stay in their own changes.

Validation: cargo check --lib passes on d846623, and tests/test_index.cpp compiles against the new header with g++ -std=c++20 -fsyntax-only. The new sections create a real BTREE index, prewarm it by name, then check that a missing name reports LANCEDB_INDEX_NOT_FOUND and that invalid arguments report LANCEDB_INVALID_ARGUMENT. The regression runs through the existing lancedb_index_tests entry point on hosted CI; there is no local C++ or valgrind run here, because C #51 holds the host's heavy build lease.

* expose Table::prewarm_index(name) as lancedb_table_prewarm_index() with the
  existing status, error message and handle ownership conventions
* report LANCEDB_INDEX_NOT_FOUND for a missing index and
  LANCEDB_INVALID_ARGUMENT for a null or non-UTF-8 name
* cover a real BTREE index, a missing name and invalid arguments in the index
  test entry point

Signed-off-by: Xuanwo <[email protected]>
@Xuanwo
Xuanwo merged commit 68ecf54 into main Nov 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant