[SPARK-43752][SQL] Support column DEFAULT values in V2 write commands#55127
Open
LuciferYang wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-43752][SQL] Support column DEFAULT values in V2 write commands#55127LuciferYang wants to merge 1 commit intoapache:masterfrom
LuciferYang wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
Author
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?
Resolve column
DEFAULTreferences in V2 write commands (AppendData,OverwriteByExpression,OverwritePartitionsDynamic).Previously,
ResolveColumnDefaultInCommandInputQueryonly handledInsertIntoStatement(V1 path) andSetVariable. V2 write commands withDEFAULTwould fail with unresolved attribute errors.Changes:
Analyzer.ResolveReferences: dispatchV2WriteCommandtoresolveColumnDefaultInCommandInputQuerywhen the query contains unresolved attributesResolveColumnDefaultInCommandInputQuery: addV2WriteCommandcase that resolvesDEFAULTby matching query columns to the table schema by positionTODO (SPARK-43752)commentWhy are the changes needed?
INSERT INTO v2_table VALUES (1, DEFAULT)fails for V2 data sources even when the table has column default values defined. This blocks V2 adoption for catalogs that supportSUPPORT_COLUMN_DEFAULT_VALUE.Does this PR introduce any user-facing change?
Yes.
DEFAULTkeyword now works inINSERT INTO/INSERT OVERWRITEfor V2 tables.How was this patch tested?
ResolveDefaultColumnsSuiteWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code 4.6