Repository navigation
table: bind configurable optimize actions and their statistics - #106
Merged
Merged
Conversation
lancedb_table_optimize stays as it is: each action runs with the SDK defaults and the statistics are discarded. The new lancedb_table_optimize_with_action binds the same SDK operation with the options of the action it runs and returns the metrics the SDK reports. * compact carries the seven SDK compaction overrides; prune carries the age in exact nanoseconds and the two tri-state flags * set_fields keeps an omitted option distinct from a value that equals the default, and the SDK's optional size fields stay optional * the result keeps the SDK's optional compaction and prune groups apart * invalid input is rejected with LANCEDB_INVALID_ARGUMENT before the table is touched: an action outside LanceDBOptimizeType, unknown option bits, sizes that do not fit in size_t, booleans other than 0 and 1, and a negative prune age * the action is a raw int in the config, so an out-of-range value is rejected instead of becoming an invalid Rust enum; the legacy function and its dispatch are unchanged * the C tests check real compaction numbers, an explicit materialize_deletions=false against the omitted default, a sub-second prune age that removes three old versions, and rejection without any version or fragment change Signed-off-by: Xuanwo <[email protected]>
The project no longer ships an x86_64-apple-darwin artifact, so the package matrix keeps the five remaining platforms. The Windows Cargo home fix from #94 stays unchanged. Signed-off-by: Xuanwo <[email protected]>
* note that an Enterprise compaction treats a target equal to the SDK default as omitted and returns placeholder metrics after submission * spell out a cutoff at now, the versions that survive it, and that tagged versions are retained unless error_if_tagged_old_versions refuses * clarify what the C++ 1µs prune case can and cannot prove * add a deterministic Rust test for the nanosecond prune age and its presence bit, without clock reads Signed-off-by: Xuanwo <[email protected]>
This was referenced Nov 21, 2026
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.
What
Adds a configurable optimize entry point bound to the SDK's
Table::optimize(OptimizeAction)and to the statistics it reports, for the Go migration'sOptimizeWithAction/OptimizeStats.lancedb_table_optimize_with_action()runs one of the existingLanceDBOptimizeTypeactions with that action's options and returns what the SDK reports.LanceDBCompactionOptionscarries the seven SDK compaction overrides behind aset_fieldsbitmask, so an omitted option keeps the SDK default and stays distinct from a value equal to it, including an explicit zero on the SDK's optional size fields.LanceDBPruneOptionscarries the age in exact nanoseconds plusdelete_unverifiedanderror_if_tagged_old_versionsbehind the same presence bits. A sub-second age keeps its exact length, zero with its bit set is a cutoff at now, and an unset bit keeps the SDK's default week-long age.LanceDBOptimizeStatscarrieshas_compactionwith the four compaction metrics andhas_prunewith the bytes and old versions removed, so the SDK's optional metric groups stay separate.actionis a raw int, so a value outside the enumerators is rejected instead of becoming an invalid Rust enum. The same holds for unknownset_fieldsbits, booleans other than 0 and 1, sizes that do not fit insize_t, and a negative age. All of it is validated beforeTable::optimizeis called.INDEXuses the SDK's defaultOptimizeOptions; index rebuild options stay in Add index rebuild options #74.error_if_tagged_old_versionsrefuses.lancedb_table_optimize()keeps its signature, defaults and dispatch, so this is an additive C API addition (minor bump at release time). The Go adapter maps nil option fields to unset bits andtime.Durationto nanoseconds; that replaces the JSONolder_than_secondsconversion and its floor-to-1s workaround with the exact duration.Header comments are the API reference (doxygen), so there is no
docs/index.rstchange.The PR also drops the
x86_64-apple-darwinpackage matrix entry, following the directive to drop Intel macOS, which leaves five shipped platforms. The Windows Cargo home fix from #94 is retained.Testing
tests/test_index.cppthrough the public header, on four 20-row fragments:materialize_deletions = falseleaves the deletion on disk while omitting the bit materializes it (the SDK default), which shows the presence bit works.delete_unverified = 1anderror_if_tagged_old_versions = 0are converted. The comment states that this young fixture proves pruning and no whole-second round-up, not the absence of a truncation to zero.ALLreports both metric groups,INDEXneither; an action outside the enumerators, unknown bits, bad booleans and a negative age returnLANCEDB_INVALID_ARGUMENTwith the field in the message and leave the version, fragment count and row count unchanged.fa20bf9(main at5388ca8): all nine CTest suites pass under the repo's valgrind configuration (139s); focused valgrind on both optimize cases reports 0 errors and 0 leaks. The later commits change only the workflow matrix, header comments and one C++ comment, so this evidence still covers the test code.cargo fmt --check,cargo clippy(lib and tests),cargo test --libandcargo check --libare clean; the header compiles as C17 with gcc and clang (-Werror) and in the C++20 test build.