-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-34637] [SQL] Support DPP + AQE when the broadcast exchange can be reused #31756
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
Changes from 1 commit
3bc4baf
657c61b
c7b3735
6b07c84
4ccd4b8
701f1c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…rstly
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -198,9 +198,15 @@ abstract class DynamicPartitionPruningSuiteBase | |
| }.isDefined | ||
| assert(hasReuse, s"$s\nshould have been reused in\n$plan") | ||
| case a: AdaptiveSparkPlanExec => | ||
| val hasReuse = collect(a) { | ||
| case r: ReusedExchangeExec => r | ||
| }.nonEmpty | ||
| val broadcastQueryStage = collectFirst(a) { | ||
| case b: BroadcastQueryStageExec => b | ||
| } | ||
| val broadcastPlan = broadcastQueryStage.get.broadcast | ||
| val hasReuse = find(plan) { | ||
| case ReusedExchangeExec(_, e) => e eq broadcastPlan | ||
| case b: BroadcastExchangeLike => b eq broadcastPlan | ||
| case _ => false | ||
| }.isDefined | ||
| assert(hasReuse, s"$s\nshould have been reused in\n$plan") | ||
| case _ => | ||
| fail(s"Invalid child node found in\n$s") | ||
|
|
@@ -1468,6 +1474,37 @@ abstract class DynamicPartitionPruningSuiteBase | |
| } | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-34637: test DPP side broadcast query stage is created firstly") { | ||
|
||
| withSQLConf(SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "true") { | ||
| val df = sql( | ||
| """ WITH view1 as ( | ||
|
||
| | SELECT f.store_id FROM fact_stats f WHERE f.units_sold = 70 group by f.store_id | ||
| | ) | ||
| | | ||
| | SELECT * FROM view1 v1 join view1 v2 WHERE v1.store_id = v2.store_id | ||
| """.stripMargin) | ||
|
|
||
| // A possible resulting query plan: | ||
| // BroadcastHashJoin | ||
| // +- HashAggregate | ||
| // +- ShuffleQueryStage | ||
| // +- Exchange | ||
| // +- HashAggregate | ||
| // +- Filter | ||
| // +- FileScan | ||
| // +- SubqueryBroadcast | ||
|
||
| // +- AdaptiveSparkPlan | ||
| // +- BroadcastQueryStage | ||
|
||
| // +- BroadcastExchange | ||
| // | ||
| // +- BroadcastQueryStage | ||
| // +- ReusedExchange | ||
|
|
||
| checkPartitionPruningPredicate(df, false, true) | ||
| checkAnswer(df, Row(15, 15) :: Nil) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| class DynamicPartitionPruningSuiteAEOff extends DynamicPartitionPruningSuiteBase | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.