Open
Conversation
…mmands The code added by SPARK-43752 to resolve column DEFAULT in V2WriteCommand (AppendData, OverwriteByExpression, OverwritePartitionsDynamic) is dead code. For `INSERT INTO v2_table VALUES (1, DEFAULT)`, the resolution flow is: 1. The parser produces `InsertIntoStatement` (for both V1 and V2 tables). 2. `ResolveReferences` resolves DEFAULT via `resolveColumnDefaultInCommandInputQuery` while still in the `InsertIntoStatement` stage. 3. `ResolveInsertInto` only converts to `V2WriteCommand` after the query is fully resolved — by which point DEFAULT is already gone. No code path creates a V2WriteCommand with unresolved DEFAULT attributes. This reverts the code changes from eca57ea and moves the test to InsertIntoTests where it runs across all V2 INSERT test suites. Co-authored-by: Isaac
Contributor
Author
LuciferYang
reviewed
Apr 15, 2026
| } | ||
| } | ||
|
|
||
| test("SPARK-43752: InsertInto: column DEFAULT values") { |
Contributor
There was a problem hiding this comment.
Do we still need to retain the "SPARK-43752:" prefix?
Contributor
This TODO already remove in #55127 |
Contributor
The new test is inside the
This is correct behavior since |
Co-authored-by: Isaac
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?
This PR reverts the code changes from #55127 (commit eca57ea) and moves the test to
InsertIntoTestswhere it properly runs across V2 INSERT SQL test suites.Specifically:
V2WriteCommandcase added toAnalyzer.ResolveReferencesandResolveColumnDefaultInCommandInputQueryResolveDefaultColumnsSuite(wrong location for a V2 end-to-end test)InsertIntoSQLOnlyTestsinInsertIntoTests.scala, which runs in suites withincludeSQLOnlyTests = true:DataSourceV2SQLSuite,DataSourceV2SQLSessionCatalogSuite, andV1WriteFallbackSessionCatalogSuite. This is correct sinceDEFAULTis SQL-only syntax.Why are the changes needed?
The code added by #55127 is dead code. For
INSERT INTO v2_table VALUES (1, DEFAULT), the resolution flow is:InsertIntoStatementfor both V1 and V2 tables.ResolveReferencesdispatchesInsertIntoStatementtoresolveColumnDefaultInCommandInputQuery, which resolves DEFAULT using the table schema. For V2 tables, theDataSourceV2Relationschema includes column default metadata (viaCatalogV2Util.encodeDefaultValue), so DEFAULT is resolved correctly at this stage.ResolveInsertIntoonly convertsInsertIntoStatementto aV2WriteCommand(AppendData/OverwriteByExpression/OverwritePartitionsDynamic) after the query is fully resolved — by which point DEFAULT is already gone.No code path (SQL or DataFrame API) creates a
V2WriteCommandwith unresolved DEFAULT attributes. ThePlanResolutionSuitetest "INSERT INTO table with default column value" already verifies this resolution at the plan level.The test is still valuable and passes without the code changes — this PR moves it to the proper location.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Moved the existing test to
InsertIntoSQLOnlyTestsinInsertIntoTests.scala. The test verifies:INSERT INTOwith partial DEFAULT valuesINSERT INTOwith all DEFAULT valuesINSERT OVERWRITEwith DEFAULT valuesWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code 4.6