[SPARK-56054][SQL] Add test for MERGE INTO schema evolution with aliased assignments#55239
Open
johanl-db wants to merge 2 commits intoapache:masterfrom
Open
[SPARK-56054][SQL] Add test for MERGE INTO schema evolution with aliased assignments#55239johanl-db wants to merge 2 commits intoapache:masterfrom
johanl-db wants to merge 2 commits intoapache:masterfrom
Conversation
szehon-ho
reviewed
Apr 7, 2026
Member
szehon-ho
left a comment
There was a problem hiding this comment.
these are all DataFrame API, wondering is there any equivalent in SQL? Be good to abstract it out if possible
If not, maybe we can we make a new file MergeIntoSchemaEvolutionExtraDataFrameTests to make them only run in DataFrame mode?
It is a bit of a mess now due to the inheritance patterns
.../org/apache/spark/sql/connector/MergeIntoSchemaEvolutionTypeWideningAndExtraFieldTests.scala
Outdated
Show resolved
Hide resolved
Contributor
Author
|
I moved the tests to a dedicated trait for dataframe tests. There's no SQL equivalent, it's not possible to specify an alias in an assignment expression using SQL afaict: |
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 were proposed in this pull request?
Follow up from #54891 in particular this comment.
Adds more tests covering schema evolution in MERGE INTO when the assignment contains an alias.
This change also undoes the fix from #54891. On closer inspection, this isn't needed in Spark as Spark already removes trivial aliases on nested field accessors in MERGE in resolveExprInAssignment, which is what the change aimed to allow. See this test added here covering trivial aliases implictily added on nested field access.
Delta doesn't strip aliases during resolution in that way and will require special handling, but that's up to Delta to implement in its custom resolution logic to replicate what Spark already does
How was this patch tested?
Adds tests covering MERGE INTO schema evolution with aliases in assignments