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-39551][SQL][3.2] Add AQE invalid plan check #37108

Closed
wants to merge 1 commit into from
Closed

[SPARK-39551][SQL][3.2] Add AQE invalid plan check #37108

wants to merge 1 commit into from

Conversation

dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Jul 6, 2022

What changes were proposed in this pull request?

This is a backport of #36953

This PR adds a check for invalid plans in AQE replanning process. The check will throw exceptions when it detects an invalid plan, causing AQE to void the current replanning result and keep using the latest valid plan.

Why are the changes needed?

AQE logical optimization rules can lead to invalid physical plans and cause runtime exceptions as certain physical plan nodes are not compatible with others. E.g., BroadcastExchangeExec can only work as a direct child of broadcast join nodes, but it could appear under other incompatible physical plan nodes because of empty relation propagation.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added UT.

This PR adds a check for invalid plans in AQE replanning process. The check will throw exceptions when it detects an invalid plan, causing AQE to void the current replanning result and keep using the latest valid plan.

AQE logical optimization rules can lead to invalid physical plans and cause runtime exceptions as certain physical plan nodes are not compatible with others. E.g., `BroadcastExchangeExec` can only work as a direct child of broadcast join nodes, but it could appear under other incompatible physical plan nodes because of empty relation propagation.

No.

Added UT.

Closes #36953 from maryannxue/validate-aqe.

Authored-by: Maryann Xue <maryann.xue@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 58b91b1)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 3cf3048)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun
Copy link
Member Author

cc @maryannxue , @cloud-fan , @ulysses-you

@ulysses-you
Copy link
Contributor

thank you @dongjoon-hyun help backport , I'm a bit late

@dongjoon-hyun
Copy link
Member Author

No problem. I wanted to have this at Apache Spark 3.2.2 RC1 next week. That's the reason why I hurried. :)

@dongjoon-hyun
Copy link
Member Author

All tests passed. Thank you, @ulysses-you and @cloud-fan .
Merged to branch-3.2.

dongjoon-hyun pushed a commit that referenced this pull request Jul 7, 2022
### What changes were proposed in this pull request?

This is a backport of #36953

This PR adds a check for invalid plans in AQE replanning process. The check will throw exceptions when it detects an invalid plan, causing AQE to void the current replanning result and keep using the latest valid plan.

### Why are the changes needed?

AQE logical optimization rules can lead to invalid physical plans and cause runtime exceptions as certain physical plan nodes are not compatible with others. E.g., `BroadcastExchangeExec` can only work as a direct child of broadcast join nodes, but it could appear under other incompatible physical plan nodes because of empty relation propagation.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Added UT.

Closes #37108 from dongjoon-hyun/SPARK-39551.

Authored-by: Maryann Xue <maryann.xue@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun dongjoon-hyun deleted the SPARK-39551 branch July 7, 2022 05:27
sunchao pushed a commit to sunchao/spark that referenced this pull request Jun 2, 2023
### What changes were proposed in this pull request?

This is a backport of apache#36953

This PR adds a check for invalid plans in AQE replanning process. The check will throw exceptions when it detects an invalid plan, causing AQE to void the current replanning result and keep using the latest valid plan.

### Why are the changes needed?

AQE logical optimization rules can lead to invalid physical plans and cause runtime exceptions as certain physical plan nodes are not compatible with others. E.g., `BroadcastExchangeExec` can only work as a direct child of broadcast join nodes, but it could appear under other incompatible physical plan nodes because of empty relation propagation.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Added UT.

Closes apache#37108 from dongjoon-hyun/SPARK-39551.

Authored-by: Maryann Xue <maryann.xue@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit be891ad)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants