[SPARK-56729][SQL] ReplaceData and WriteDelta should implement SupportsNonDeterministicExpression#55858
Open
yadavay-amzn wants to merge 1 commit into
Open
Conversation
0e27dd2 to
8007ce8
Compare
…tsNonDeterministicExpression MERGE INTO queries fail with INVALID_NON_DETERMINISTIC_EXPRESSIONS when the source plan contains non-deterministic expressions (e.g. uuid(), current_timestamp()). This regression was introduced in Spark 3.5 when RewriteMergeIntoTable moved into core. The fix has ReplaceData and WriteDelta extend SupportsNonDeterministicExpression with allowNonDeterministicExpression=true, which CheckAnalysis already respects. Closes SPARK-56729
8007ce8 to
567d133
Compare
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?
Have
ReplaceDataandWriteDeltaextendSupportsNonDeterministicExpressionwithallowNonDeterministicExpression = true.Why are the changes needed?
MERGE INTO queries fail with
INVALID_NON_DETERMINISTIC_EXPRESSIONSwhen the source plan contains non-deterministic expressions (e.g.uuid(),current_timestamp(),input_file_name()). This is a regression from Spark 3.3 introduced whenRewriteMergeIntoTablemoved into core in 3.5.The root cause is that
ReplaceData(copy-on-write) andWriteDelta(merge-on-read) do not implementSupportsNonDeterministicExpression, soCheckAnalysisrejects them. SPARK-48871 introduced this trait for exactly this class of problem.Does this PR introduce any user-facing change?
Yes. MERGE INTO with non-deterministic source plans on DSv2 tables (e.g. Iceberg) will no longer fail.
How was this patch tested?
Added test in
AnalysisErrorSuiteverifying both classes implement the trait.Was this patch authored or co-authored using generative AI tooling?
Yes