Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-44138][SQL] Prohibit non-deterministic expressions, subqueries and aggregates in MERGE conditions #41694

Closed
wants to merge 2 commits into from

Conversation

aokolnychyi
Copy link
Contributor

What changes were proposed in this pull request?

This PR adds descriptive errors for cases when MERGE statements that are converted into executable plans by Spark contain unsupported expressions such as non-deterministic functions, subqueries, and aggregates.

Why are the changes needed?

These changes are needed as the current version of the row-level framework does not support these operations. Keep in mind the new validation only applies to MERGE statements that are rewritten by RewriteMergeIntoTable. Data sources that inject their own implementation are NOT affected.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

This PR comes with tests.

@aokolnychyi
Copy link
Contributor Author

The test failure is unrelated, triggered again.

org.apache.spark.storage.BlockManagerProactiveReplicationSuite

@aokolnychyi
Copy link
Contributor Author

aokolnychyi commented Jun 22, 2023

cc @dongjoon-hyun

This is a follow-up PR to #41448 and #41577.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @aokolnychyi .
Merged to master for Apache Spark 3.5.0.

@aokolnychyi
Copy link
Contributor Author

Thank you, @dongjoon-hyun!

viirya pushed a commit to viirya/spark-1 that referenced this pull request Oct 19, 2023
… and aggregates in MERGE conditions

This PR adds descriptive errors for cases when MERGE statements that are converted into executable plans by Spark contain unsupported expressions such as non-deterministic functions, subqueries, and aggregates.

These changes are needed as the current version of the row-level framework does not support these operations. Keep in mind the new validation only applies to MERGE statements that are rewritten by `RewriteMergeIntoTable`. Data sources that inject their own implementation are NOT affected.

No.

This PR comes with tests.

Closes apache#41694 from aokolnychyi/spark-44138.

Authored-by: aokolnychyi <aokolnychyi@apple.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 87bc64b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants