Repository navigation
Conversation
A new dataset could only get non-reusable field IDs through a separate migration commit after it was written. Add WriteParams::enable_non_reusable_field_ids and the same option on Python's write_dataset. When the write creates the dataset, its first manifest is activated. A new dataset has no older writers, so the migration's warning about clients that ignore writer feature flags does not apply. Like enable_stable_row_ids, the option does not change an existing dataset: appends and overwrites keep its setting, and migrate_to_non_reusable_field_ids remains the way to opt in later. Part of lance-format#10684.
Xuanwo
left a comment
There was a problem hiding this comment.
AI-assisted source review of 4c3cc0ce. Both InsertBuilder::execute_uncommitted entry points lose the enable_non_reusable_field_ids opt-in on create. do_commit applies it for one-step writes, but the staged Overwrite transaction carries no activation flag. The public lance::dataset::CommitBuilder then creates version 1 with reusable IDs. Its field-ID activation setter is crate-private.
Please support activation on the first commit in the public two-stage path, or reject the opt-in explicitly when returning an uncommitted create. For the supported path, please commit through the public builder, reopen, drop the highest-ID column and verify that its replacement gets a fresh ID. Staged writes in #10684 depend on that identity.
A staged create returned by InsertBuilder::execute_uncommitted (or execute_uncommitted_stream) cannot carry enable_non_reusable_field_ids to the commit, so committing it through the public CommitBuilder created a dataset with reusable field IDs. Add CommitBuilder::use_non_reusable_field_ids, which activates a dataset the commit creates, and use it for one-step writes too. A staged create that sets the option on WriteParams is rejected before any data file is written, pointing to the builder setter.
|
Thanks @Xuanwo, confirmed and fixed in 2be6d3f. It now does both: the public two-stage path is supported, and the staged
Regression test:
I can't add labels from a fork, so could a maintainer add |
…on-reusable-field-ids # Conflicts: # python/python/tests/test_dataset.py # rust/lance-table-runtime/src/write/insert.rs
A clone copies its source's manifest instead of building one, so the activation set by use_non_reusable_field_ids never reached it: the clone committed without the high-water mark or writer flag and reused field IDs. Refuse the combination with InvalidInput before anything is written, pointing to migrate_to_non_reusable_field_ids on the clone.
|
Thanks for catching the clone path. Fixed in 9705cec. A clone copies its source's manifest rather than building one, so
I also merged main into the branch (2ea587b) to resolve the conflicts with the new write-stage instrumentation in
|
There was a problem hiding this comment.
✅ Gate recommendation: approve.
Verified the author’s fix: clone commits now reject the opt-in explicitly, closing the remaining finding. Both staged creation paths retain their guards, and activation through the public commit builder preserves non-reusable field IDs.
Please mark this PR with the breaking-change label: lance::dataset::WriteParams and lance_table_runtime::write::WriteParams gain enable_non_reusable_field_ids, so Rust callers using exhaustive struct literals must initialize the new field.
Part of #10684 (item 2: a create-time option). Item 1, the Python and Java bindings for
migrate_to_non_reusable_field_ids, is #11472.A new dataset could only get non-reusable field IDs through a separate migration commit after its first write. As the issue notes, a new dataset has no older writers, so the migration's warning about clients that ignore writer feature flags doesn't apply to it.
Changes:
WriteParams::enable_non_reusable_field_ids(Rust) andenable_non_reusable_field_ids=onlance.write_dataset(Python).InsertBuildercommits it withwith_non_reusable_field_id_migration_activation(), so the first manifest records the high-water mark and setsFLAG_NON_REUSABLE_FIELD_IDS.CommitBuilder::use_non_reusable_field_ids(bool)(public, in bothlanceandlance-table-runtime) activates a dataset the commit creates. One-step writes go through it, and it's the opt-in for committing a create staged withexecute_uncommitted.execute_uncommittedandexecute_uncommitted_streamrejectenable_non_reusable_field_idson a create, before writing any data file, because a transaction can't carry it to the commit.enable_stable_row_ids, the option doesn't change an existing dataset. Appends and overwrites keep its setting, because it may have older writers.migrate_to_non_reusable_field_idsstays the way to opt in later.This adds a public field to
WriteParams, so Rust code that builds it with an exhaustive struct literal must set it.Tests:
test_enable_non_reusable_field_ids_applies_to_new_datasets, with casescreate,append_to_existingandoverwrite_existing. It checks the high-water mark and writer flag, then adds, drops and re-adds a column. The re-added column gets a fresh ID (2) only on the created dataset, and reuses ID 1 otherwise.test_staged_create_with_non_reusable_field_ids[stream=false/true]. A staged create with the opt-in is rejected with no data files left behind. A staged create committed withuse_non_reusable_field_ids(true)gives the replacement of the dropped highest-ID column a fresh ID.test_write_dataset_enable_non_reusable_field_ids[False/True]covers the same add/drop/add sequence throughwrite_dataset.Checks run locally:
cargo test -p lance --lib -- non_reusable: 18 passed.cargo checkpasses forpython/.migrate_to_non_reusable_field_ids, which feat: expose migrate_to_non_reusable_field_ids in Python and Java #11472 adds.