[SPARK-56462][SQL]Fix UPDATE/INSERT schema evolution when source col contains dot#55329
Open
jiwen624 wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-56462][SQL]Fix UPDATE/INSERT schema evolution when source col contains dot#55329jiwen624 wants to merge 1 commit intoapache:masterfrom
jiwen624 wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
Author
|
@dongjoon-hyun @cloud-fan @HyukjinKwon could you let me know your thoughts on this fix? Thanks |
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?
In
Analyzer.scala, theUPDATE *andINSERT *schema-evolution paths insideResolveReferencesbuilt assignment keys for new source columns usingUnresolvedAttribute(sourceAttr.name). That constructor splits the name on dots, so a column named`job.title`producednameParts = Seq("job", "title")instead ofSeq("job.title").The fix replaces both call sites with
UnresolvedAttribute.quoted(sourceAttr.name), which treats the whole name as a single quoted identifier.Why are the changes needed?
With a dot in the source column name,

isSameColumnAssignmentcompared a two-part key against a single-part value and returned false, blocking schema evolution. Analysis then failed withUNRESOLVED_COLUMN.Does this PR introduce any user-facing change?
Yes.
MERGE INTO … WHEN MATCHED UPDATE * WHEN NOT MATCHED INSERT *with schema evolution now correctly handles source columns whose names contain a dot.How was this patch tested?
Added a
testEvolutioncase inMergeIntoSchemaEvolutionBasicTestscovering both schema-evolution-enabled (dot-named column is added and populated) and schema-evolution-disabled (extra column is silently ignored).Was this patch authored or co-authored using generative AI tooling?
Yes.