Uh oh!
There was an error while loading. Please reload this page.
[SPARK-33472][SQL] Adjust RemoveRedundantSorts rule order - #30373
[SPARK-33472][SQL] Adjust RemoveRedundantSorts rule order#30373allisonwang-db wants to merge 3 commits into
Conversation
SparkQA
commented
Nov 14, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 14, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 14, 2020
Test build #131085 has finished for PR 30373 at commit
|
| RemoveRedundantProjects, | ||
| RemoveRedundantSorts, | ||
| EnsureRequirements, | ||
| RemoveRedundantSorts, |
There was a problem hiding this comment.
Could you leave some comments here about why we need to put this rule after EnsureRequirements?
| } | ||
| } | ||
| test("shuffled join with different left and right side partition numbers") { |
There was a problem hiding this comment.
nit: could you add the prefix: SPARK-33183:
| (0 to 100).toDF("key").createOrReplaceTempView("t2") | ||
| // left side partitioning: RangePartitioning(key ASC, 2) | ||
| // right side partitioning: UnknownPartitioning(0) |
There was a problem hiding this comment.
Could you add assert to check if the query below has the output partitions above?
There was a problem hiding this comment.
@allisonwang-db . Please split this PR.
- Please create a new JIRA for
RemoveRedundantSorts. This looks worth. - Version update PR can be a follow-up.
SparkQA
commented
Nov 18, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 18, 2020
Kubernetes integration test status failure |
dongjoon-hyun
commented
Nov 18, 2020
cc @cloud-fan |
SparkQA
commented
Nov 18, 2020
Test build #131240 has finished for PR 30373 at commit
|
cloud-fan
commented
Nov 18, 2020
retest this please |
SparkQA
commented
Nov 18, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 18, 2020
Kubernetes integration test status failure |
SparkQA
commented
Nov 18, 2020
Test build #131256 has finished for PR 30373 at commit
|
cloud-fan
commented
Nov 18, 2020
retest this please |
SparkQA
commented
Nov 18, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 18, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 18, 2020
Test build #131282 has finished for PR 30373 at commit
|
fa6050a to
4e684dfCompareSparkQA
commented
Nov 19, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 19, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 19, 2020
Test build #131319 has finished for PR 30373 at commit
|
cloud-fan
commented
Nov 19, 2020
thanks, merging to master! |
cloud-fan
commented
Nov 19, 2020
@allisonwang-db can you create backport PRs for 2.4 and 3.0? |
This PR switched the order for the rule `RemoveRedundantSorts` and `EnsureRequirements` so that `EnsureRequirements` will be invoked before `RemoveRedundantSorts` to avoid IllegalArgumentException when instantiating PartitioningCollection. `RemoveRedundantSorts` rule uses SparkPlan's `outputPartitioning` to check whether a sort node is redundant. Currently, it is added before `EnsureRequirements`. Since `PartitioningCollection` requires left and right partitioning to have the same number of partitions, which is not necessarily true before applying `EnsureRequirements`, the rule can fail with the following exception: ``` IllegalArgumentException: requirement failed: PartitioningCollection requires all of its partitionings have the same numPartitions. ``` No Unit test Closesapache#30373 from allisonwang-db/sort-follow-up. Authored-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit a03c540) Signed-off-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com>
This PR switched the order for the rule `RemoveRedundantSorts` and `EnsureRequirements` so that `EnsureRequirements` will be invoked before `RemoveRedundantSorts` to avoid IllegalArgumentException when instantiating PartitioningCollection. `RemoveRedundantSorts` rule uses SparkPlan's `outputPartitioning` to check whether a sort node is redundant. Currently, it is added before `EnsureRequirements`. Since `PartitioningCollection` requires left and right partitioning to have the same number of partitions, which is not necessarily true before applying `EnsureRequirements`, the rule can fail with the following exception: ``` IllegalArgumentException: requirement failed: PartitioningCollection requires all of its partitionings have the same numPartitions. ``` No Unit test Closesapache#30373 from allisonwang-db/sort-follow-up. Authored-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit a03c540) Signed-off-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com>
dongjoon-hyun
commented
Nov 20, 2020
Thank you, @allisonwang-db , @maropu , @cloud-fan ! |
Backport #30373 for branch-3.0. ### What changes were proposed in this pull request? This PR switched the order for the rule `RemoveRedundantSorts` and `EnsureRequirements` so that `EnsureRequirements` will be invoked before `RemoveRedundantSorts` to avoid IllegalArgumentException when instantiating PartitioningCollection. ### Why are the changes needed? `RemoveRedundantSorts` rule uses SparkPlan's `outputPartitioning` to check whether a sort node is redundant. Currently, it is added before `EnsureRequirements`. Since `PartitioningCollection` requires left and right partitioning to have the same number of partitions, which is not necessarily true before applying `EnsureRequirements`, the rule can fail with the following exception: ``` IllegalArgumentException: requirement failed: PartitioningCollection requires all of its partitionings have the same numPartitions. ``` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unit test Closes#30438 from allisonwang-db/spark-33472-3.0. Authored-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Backport #30373 for branch-2.4. ### What changes were proposed in this pull request? This PR switched the order for the rule `RemoveRedundantSorts` and `EnsureRequirements` so that `EnsureRequirements` will be invoked before `RemoveRedundantSorts` to avoid IllegalArgumentException when instantiating PartitioningCollection. ### Why are the changes needed? `RemoveRedundantSorts` rule uses SparkPlan's `outputPartitioning` to check whether a sort node is redundant. Currently, it is added before `EnsureRequirements`. Since `PartitioningCollection` requires left and right partitioning to have the same number of partitions, which is not necessarily true before applying `EnsureRequirements`, the rule can fail with the following exception: ``` IllegalArgumentException: requirement failed: PartitioningCollection requires all of its partitionings have the same numPartitions. ``` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unit test Closes#30437 from allisonwang-db/spark-33472-2.4. Authored-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
| RemoveRedundantProjects, | ||
| RemoveRedundantSorts, | ||
| EnsureRequirements, | ||
| // `RemoveRedundantSorts` needs to be added before `EnsureRequirements` to guarantee the same |
There was a problem hiding this comment.
Thanks for catching it! Will create a fix.
### What changes were proposed in this pull request? This PR is a follow-up for #30373 that updates the comment for RemoveRedundantSorts in QueryExecution. ### Why are the changes needed? To update an incorrect comment. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A Closes#30584 from allisonwang-db/spark-33472-followup. Authored-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
### What changes were proposed in this pull request? This PR is a follow-up for #30373 that updates the comment for RemoveRedundantSorts in QueryExecution. ### Why are the changes needed? To update an incorrect comment. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A Closes#30584 from allisonwang-db/spark-33472-followup. Authored-by: allisonwang-db <66282705+allisonwang-db@users.noreply.github.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 960d6af) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
What changes were proposed in this pull request?
This PR switched the order for the rule
RemoveRedundantSortsandEnsureRequirementsso thatEnsureRequirementswill be invoked beforeRemoveRedundantSortsto avoid IllegalArgumentException when instantiating PartitioningCollection.Why are the changes needed?
RemoveRedundantSortsrule uses SparkPlan'soutputPartitioningto check whether a sort node is redundant. Currently, it is added beforeEnsureRequirements. SincePartitioningCollectionrequires left and right partitioning to have the same number of partitions, which is not necessarily true before applyingEnsureRequirements, the rule can fail with the following exception:Does this PR introduce any user-facing change?
No
How was this patch tested?
Unit test