Uh oh!
There was an error while loading. Please reload this page.
[SPARK-43021][SQL] CoalesceBucketsInJoin not work when using AQE - #40688
[SPARK-43021][SQL] CoalesceBucketsInJoin not work when using AQE#40688zzzzming95 wants to merge 4 commits into
CoalesceBucketsInJoin not work when using AQE#40688Conversation
CoalesceBucketsInJoin not work when using AQECoalesceBucketsInJoin not work when using AQEdongjoon-hyun
commented
Apr 7, 2023
cc @imback82, @cloud-fan , @viirya , @sunchao |
Uh oh!
There was an error while loading. Please reload this page.
zzzzming95
commented
Apr 7, 2023
yeah , i will add UT later |
zzzzming95
commented
Apr 7, 2023
One more question , it time to make the default value of |
dongjoon-hyun
commented
Apr 7, 2023
Maybe, no? If this is not working properly before, we cannot enable this configuration at Apache Spark 3.5.0. Since we need to wait for one release cycle, we may be able to do that at Apache Spark 3.6.0 if we want.
|
zzzzming95
commented
Apr 8, 2023
Yes, this is the more logical way. |
zzzzming95
commented
Apr 8, 2023
The CI build failure doesn't seem to be caused by this patch, can you take a look? |
dongjoon-hyun
commented
Apr 10, 2023
Please rebase to the
|
There was a problem hiding this comment.
shall we put it in queryStageOptimizerRules?
There was a problem hiding this comment.
rules in queryStageOptimizerRules are invoked less often which is more efficient. The rule CoalesceBucketsInJoin does not change plan partitioning and seems can be put in queryStageOptimizerRules
There was a problem hiding this comment.
In my test , the UT run failed if CoalesceBucketsInJoin add in queryStageOptimizerRules .
There was a problem hiding this comment.
Can we spend a bit of time understanding why? Then we can write a code comment to explain it and future developers won't try to move this rule to queryStageOptimizerRules ever.
There was a problem hiding this comment.
Yeah , I will provide detailed information and supplement it .
There was a problem hiding this comment.
Because queryStageOptimizerRules is not applied at the beginning of the init plan. Instead, they are applied in the createQueryStages() method. And createQueryStages() is bottom-up, which causes the exchange to be eliminated to be wrapped in a layer of ShuffleQueryStage first, making CoalesceBucketsInJoin unrecognizable. And I have added these to the notes at the top. thanks @cloud-fan
There was a problem hiding this comment.
CoalesceBucketsInJoin should before EnsureRequirements.
zzzzming95
commented
Apr 11, 2023
@cloud-fan@dongjoon-hyun@viirya Please merge to master . Thanks ~ |
dongjoon-hyun
commented
Apr 11, 2023
To be clear, this PR didn't get any approval yet, @zzzzming95 .
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| assert(scans.head.optionalNumCoalescedBuckets == expectedCoalescedNumBuckets) | ||
| } else { | ||
| assert(scans.isEmpty) | ||
| query: String, |
There was a problem hiding this comment.
nit: the indentation is wrong now, can we restore to 4 spaces as before?
There was a problem hiding this comment.
Can we follow https://github.com/apache/spark/pull/40731/files#diff-1dd0d5a38f73f2993e5852f759a3934396c083d4fc4cc334e73ccc8eb929a717R1013 to update the test?
There was a problem hiding this comment.
The original DisableAdaptiveExecution logic of this UT is removed here. The current implementation does both.
| query: String, | ||
| expectedNumShuffles: Int, | ||
| expectedCoalescedNumBuckets: Option[Int]): Unit = { |
There was a problem hiding this comment.
| query: String, | |
| expectedNumShuffles: Int, | |
| expectedCoalescedNumBuckets: Option[Int]):Unit= { | |
| query: String, | |
| expectedNumShuffles: Int, | |
| expectedCoalescedNumBuckets: Option[Int]):Unit= { |
cloud-fan
commented
Apr 14, 2023
thanks, merging to master! |
neshkeev
commented
Apr 29, 2023
I was the OP of the issue in the jira. Thank you for the fix, but I discovered a weird behavior when hints applied and I don't know how to interpret it. Please check SPARK-43326 I filled |
zzzzming95
commented
Apr 29, 2023
Okay, I will follow up on this issue |
What changes were proposed in this pull request?
Add
CoalesceBucketsInJointo AQEpreprocessingRules.Why are the changes needed?
Previously optimized bucket join: 'CoalesceBucketsInJoin'` : #28123
But when using AQE ,
CoalesceBucketsInJoincan not match beacuse the top of the spark plan isAdaptiveSparkPlan.The code :
Before the PR
After the PR output:
Additional Notes:
We don't add CoalesceBucketsInJoin to
AdaptiveSparkPlanExec#queryStageOptimizerRulesbecause queryStageOptimizerRules is not applied at the beginning of the init plan. Instead, they are applied in the createQueryStages() method. And createQueryStages() is bottom-up, which causes the exchange to be eliminated to be wrapped in a layer of ShuffleQueryStage first, making CoalesceBucketsInJoin unrecognizable.Does this PR introduce any user-facing change?
No
How was this patch tested?
add UT