test: add ALTER TABLE tests validating existing column mapping annotations - #2502
Merged
Merged
Conversation
This was referenced Apr 30, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2502 +/- ##
=======================================
Coverage 88.64% 88.64%
=======================================
Files 216 216
Lines 69450 69450
Branches 69450 69450
=======================================
Hits 61567 61567
Misses 5576 5576
Partials 2307 2307 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sanujbasu
force-pushed
the
stack/preserve-cm-alter-tests
branch
2 times, most recently
from
May 1, 2026 08:54
7ef58b4 to
d5064b7
Compare
sanujbasu
force-pushed
the
stack/preserve-cm-alter-tests
branch
2 times, most recently
from
May 12, 2026 10:19
e1920fa to
905d9d2
Compare
sanujbasu
force-pushed
the
stack/preserve-cm-alter-tests
branch
from
May 14, 2026 01:14
905d9d2 to
e45b286
Compare
sanujbasu
marked this pull request as ready for review
May 14, 2026 01:15
sanujbasu
force-pushed
the
stack/preserve-cm-alter-tests
branch
from
June 19, 2026 01:19
e45b286 to
6d4aa0e
Compare
Benchmark results: ✅ PassSummary: 🚀 0 · ✅ 10 · ☑️ 3 · 🚧 1 · ❌ 0 Per-benchmark results (14 rows)
Legend: 🚀 ≥1.15x faster · ✅ faster or unchanged · ☑️ ≤1.03x slower · 🚧 1.03x-1.15x slower · ❌ ≥1.15x slower |
sanujbasu
force-pushed
the
stack/preserve-cm-alter-tests
branch
from
June 22, 2026 23:02
6d4aa0e to
4f2974c
Compare
… mapping
The 3-way rewrite of try_assign_field_column_mapping flows straight
through apply_schema_operations, so the same preserve/fill/assign
matrix applies to ALTER as to CREATE. These tests pin that contract
end-to-end through the alter -> snapshot read roundtrip:
- both id + physicalName preserved when fully supplied
(in name and id modes)
- id allocated when only physicalName is supplied
- physicalName filled when only id is supplied
- supplied id less than the existing maxColumnId is accepted as long
as it doesn't collide. This matches Spark and diverges from the
Java Kernel proposal in delta-io/delta#4520.
- supplied id that collides with an existing field is rejected
Refs delta-io#2377.
sanujbasu
added a commit
to sanujbasu/delta-kernel-rs
that referenced
this pull request
Jun 23, 2026
…ta-io#2501) ## Stacked PR Use this [link](https://github.com/delta-io/delta-kernel-rs/pull/2501/files) to review incremental changes. - [stack/preserve-cm-feat](delta-io#2500) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2500/files)] [MERGED] - [**stack/preserve-cm-create-tests**](delta-io#2501) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2501/files)] (this PR) - [stack/preserve-cm-alter-tests](delta-io#2502) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2502/files)] --------- ## What changes are proposed in this pull request? Integration tests pinning column-mapping (CM) metadata preservation end-to-end through the public create-table -> snapshot-reload path. The underlying preserve/fill/reject logic is unit-tested in `table_features::column_mapping` and `schema` (`make_physical`); these tests cover the public wiring and on-disk persistence: - complete CM metadata (id + physicalName) preserved verbatim - physicalName filled with col-<uuid> when only id is supplied - id allocated when only physicalName is supplied - sparse preserved ids (1, 5, 100) seed new allocations above the max (101+) - CM metadata preserved under nested struct fields Also loosens `assert_column_mapping_config` to compare maxColumnId against the schema's actual largest mapping id rather than the total field count. The old invariant only held when the kernel assigned every id itself; preserving connector-supplied ids breaks it. Refs delta-io#2377. ## How was this change tested? New integration tests in kernel/tests/integration/create_table/column_mapping.rs, run with `cargo test -p delta_kernel --all-features --test integration`. fmt, clippy, and the full suite pass. Co-authored-by: Sanuj Basu <sanujbasu@users.noreply.github.com>
sanujbasu
force-pushed
the
stack/preserve-cm-alter-tests
branch
from
June 23, 2026 06:45
4f2974c to
2e1694f
Compare
DrakeLin
approved these changes
Jun 23, 2026
dengsh12
approved these changes
Jun 23, 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 changes are proposed in this pull request?
ALTER TABLE ADD COLUMN flows through the same column-mapping preserve/fill/assign
path as CREATE (try_assign_field_column_mapping -> apply_schema_operations). These
integration tests pin that contract end-to-end through the alter -> snapshot-reload
roundtrip:
(matches delta-spark; diverges from the Java Kernel proposal in [Kernel] Update column mapping and schema evolution code to support usage with replace table delta#4520)
Refs #2377.
How was this change tested?
New integration tests in kernel/tests/integration/features/alter_table.rs, run with
cargo test -p delta_kernel --all-features --test integration. fmt, clippy, and thefull suite pass.