Repository navigation
index: expose index names, columns and types - #90
Merged
Merged
Conversation
Add lancedb_table_list_indices_info() and LanceDBIndexInfo, backed by the SDK's Table::list_indices and IndexConfig. The new call returns the full index name, the ordered column list and the SDK index type string, while lancedb_table_list_indices() keeps returning names only. The result owns every string and the column array and is released with lancedb_free_index_info(). Empty listings return a NULL array and count zero; allocation and UTF-8 conversion failures release the partial result and report LANCEDB_OTHER. The C++ regression creates BTREE and BITMAP indices on distinct columns, checks both metadata entries against the SDK-assigned names and types, and verifies the names-only list is unchanged. Signed-off-by: Xuanwo <[email protected]>
Convert the index name, type and columns into Rust-owned CString values before building the C result. This removes the partially initialized C struct and its per-field null checks; a failure now only has to free the entries completed before the failing one. The column array is always allocated, so every returned entry has one freeable array even when the SDK reports no columns. Signed-off-by: Xuanwo <[email protected]>
Build each LanceDBIndexInfo only after all of its strings are converted, let Drop release the owned strings and column array, and free the returned slice through Box. A conversion failure now drops the already built entries, so the listing no longer needs a manual partial-result cleanup path. The public free function still accepts a NULL pointer. Signed-off-by: Xuanwo <[email protected]>
Keep the pointers and count that Drop trusts private on the Rust side, and make the C view const at every level: the returned object array, the name and type strings, the nested column pointers and the column count. The free operation accepts the same const view. This prevents ordinary C callers from replacing an owned pointer or changing a length before the matching free, without changing the repr(C) layout or calling ABI. Signed-off-by: Xuanwo <[email protected]>
Xuanwo dropped Intel macOS support. Remove only the x86_64-apple-darwin matrix entry so a fresh push does not launch macos-15-intel. The packaging script and documentation cleanup ships separately. Signed-off-by: Xuanwo <[email protected]>
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.
Summary
Add a rich index listing for the Go
GetAllIndexesmigration while keeping the existing names-only call unchanged.LanceDBIndexInfo { name, columns, num_columns, index_type }lancedb_table_list_indices_info()backed by the SDK'sTable::list_indices/IndexConfiglancedb_free_index_info()releases the owned strings and arrayindex_typeisIndexType::to_string()from the SDK, so types the C enum does not know (including future or custom values) survive. An empty table returnscount = 0and a NULL array. If column-array allocation fails or a string contains an interior NUL, the call drops partial results, leaves the outputs NULL/0, and returnsLANCEDB_UNKNOWN. Rust allocations follow the library’s normal out-of-memory behavior.Scope: rich stats, loss, creation options, prewarm (#83), wait (#85), enum validation (#75) and index optimization (#74) stay out.
SDK compatibility
Checked
IndexConfigandlist_indices()in pinnedlancedb0.33.0 and targetv0.42.0-beta.21: both exposename: String,columns: Vec<String>,index_type: IndexType, andIndexType: Display. The test observes theBTREEandBITMAPtype strings.Validation
cargo fmt --checkcargo check --libcargo clippy --lib -- -D warnings-fsyntax-onlyagainst the public headerg++ -std=c++20 -fsyntax-only tests/test_index_info.cppwith the system Arrow/Catch2 headerslancedb_index_testsunder valgrind; the regression creates BTREE onkeyand BITMAP oncategory, verifies both metadata entries, the distinct SDK-assigned names (key_idx,category_idx), their types, and that the names-only list is unchanged.A local heavy C/C++ build and valgrind run was not started because C #75 held the host build lease at dispatch time.
Integration
get_runtimeand usesrun_blockingwith a cloned table. Whichever lands second must convertlancedb_table_list_indices_infothe same way; there is no behavior conflict, only that compile-time adaptation.lancedb_table_list_indices; this patch adds a separate block afterlancedb_free_index_listinsrc/index.rsand afterlancedb_free_arrow_arraysin the header, so the hunks do not overlap.