[SPARK-58330][SQL] Prevent silent dropping of dynamic options on same table references in DML#57508
Open
anuragmantri wants to merge 1 commit into
Open
[SPARK-58330][SQL] Prevent silent dropping of dynamic options on same table references in DML#57508anuragmantri wants to merge 1 commit into
anuragmantri wants to merge 1 commit into
Conversation
…e table references in DML
anuragmantri
force-pushed
the
self-ref-options
branch
from
July 24, 2026 20:07
ea6734f to
9fb252f
Compare
Contributor
Author
|
@dongjoon-hyun @peter-toth - Please provide your review on this. |
dongjoon-hyun
approved these changes
Jul 24, 2026
dongjoon-hyun
left a comment
Member
There was a problem hiding this comment.
+1, LGTM. Thank you, @anuragmantri .
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 fixes dynamic table options being silently dropped when the same table is referenced more than once in a single DML statement. Options are now re-applied on a per-query relation cache hit, so each reference keeps its own options.
Why are the changes needed?
The per-query relation cache in RelationResolution is keyed by catalog, namespace, name, and time travel spec, but not by options. When the same table is referenced twice in one statement with different options, the second reference gets a cache hit and reuses the first reference's options, so the options the user wrote on the second reference are silently ignored. This affects INSERT, UPDATE, and MERGE.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added end-to-end tests to the following suites, each asserting that both references keep their own options:
DataSourceV2OptionSuite(INSERT selecting from the same table)MergeIntoTableSuiteBaseUpdateTableSuiteBaseWas this patch authored or co-authored using generative AI tooling?
I used Claude Code (Claude Opus 4.8) to generate the code and tests and verified manually.