Skip to content

[Kernel] Support column mapping mode in REPLACE TABLE including with fieldId re-use #4518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

allisonport-db
Copy link
Collaborator

@allisonport-db allisonport-db commented May 8, 2025

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

PR#1 here #4520 separates some of this out.

This PR re-enables support for column mapping tables with REPLACE, and allows fieldId re-use when the type/nullability is compatible. To check for this compatibility we essentially re-use our schema evolution code. Valid schema transformations in the normal case should also be valid changes when reusing fieldIds across REPLACE. Any fields in the replaceSchema that are not reusing existing fieldIds will be treated as new fields during the schema evolution validation.

This validation checks that nullability changes are valid (cannot change from nullable to non-nullable) and that type changes are valid (for now, cannot change types). Columns are able to be moved (or nested columns dropped) if the other invariants hold.

Note, this currently restricts REPLACE to operations that maintain the same column mapping mode. In the future, we will loosen this restriction but for now this lessens the scope of this PR.

How was this patch tested?

Adds unit tests.

@allisonport-db allisonport-db changed the title [WIP][Kernel] Support column mapping mode in replace table with fieldId re-use [Kernel] Support column mapping mode in REPLACE TABLE including with fieldId re-use May 9, 2025
@allisonport-db allisonport-db merged commit 0bc4199 into delta-io:master May 13, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants