Repository navigation
fix(compaction): reject unsafe binary column layouts - #8510
Conversation
# Conflicts: # rust/lance/src/dataset/optimize.rs # rust/lance/src/dataset/optimize/tests/binary_copy.rs
|
Blocked: PR #8510 at remote head The current |
# Conflicts: # rust/lance/src/dataset/optimize/tests/binary_copy.rs
|
Blocked: PR #8510 at remote head The current |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The latest base only optimizes manifest column-index validation; this PR still applies the version-specific canonical-mapping guard before the restored binary-copy implementation. Noncanonical inputs safely re-encode under TryBinaryCopy, while canonical nested and packed layouts remain eligible across V2.0–V2.3. With PR #8660 reverted by PR #8926, retaining this conservative boundary here remains correct.
## Summary - require binary-copy inputs to use the physical column mapping derived from the dataset schema - let `TryBinaryCopy` safely fall back to re-encoding when files use another physical column order - add a Decimal128/UInt64 regression covering two uniformly reordered fragments and value round-tripping ## Root cause Binary-copy eligibility only required source files to agree with one another. The copy loop preserved their physical page order, but output metadata was regenerated in dataset-schema order, so uniformly reordered source files crossed logical columns after compaction. ## Related work PR lance-format#8479 proposes the same eligibility invariant for the separate metadata-only schema-evolution scenario in lance-format#8281. This repair is tied to the direct public-API reordered-column reproduction in lance-format#8501 and adds regression coverage for that distinct trigger. ## Validation - `cargo test -p lance dataset::optimize::tests::binary_copy` (19 passed) - `cargo fmt --all -- --check` - `cargo clippy --all --tests --benches -- -D warnings` Fixes lance-format#8501 <!-- lance-gatekeeper-fix:v1 agent=25608d6e39ef7bff453cc3ae371d5553 generation=1 --> Co-authored-by: Gatefixer <312823363+lance-gatefixer[bot]@users.noreply.github.com> Co-authored-by: Xuanwo <[email protected]> (backported from commit c4086ca, upstream lance-format#8510; adapted to release-10.0.0) Adapted: release-10.0.0 has no lance_file::versions::data_file_columns, so binary_copy::data_file_columns ports it: the (fields, column_indices) the release-10.0.0 writer records for the dataset schema, with every field in pre-order for v2.0 and only leaves, blobs and packed structs for v2.1+. test_binary_copy_packed_struct_column_mapping does not exist on release-10.0.0 and is not added. Adds test_binary_copy_falls_back_after_drop_columns for the drop_columns route, where the data files keep the dropped column and binary copy indexed past the schema's columns.
Summary
TryBinaryCopysafely fall back to re-encoding when files use another physical column orderRoot cause
Binary-copy eligibility only required source files to agree with one another. The copy loop preserved their physical page order, but output metadata was regenerated in dataset-schema order, so uniformly reordered source files crossed logical columns after compaction.
Related work
PR #8479 proposes the same eligibility invariant for the separate metadata-only schema-evolution scenario in #8281. This repair is tied to the direct public-API reordered-column reproduction in #8501 and adds regression coverage for that distinct trigger.
Validation
cargo test -p lance dataset::optimize::tests::binary_copy(19 passed)cargo fmt --all -- --checkcargo clippy --all --tests --benches -- -D warningsFixes #8501