Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19714#discussion_r153583308
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala ---
@@ -153,6 +151,27 @@ abstract class SparkStrategies extends
QueryPlanner[SparkPlan] {
// --- BroadcastHashJoin
--------------------------------------------------------------------
+ case ExtractEquiJoinKeys(joinType, leftKeys, rightKeys, condition,
left, right)
+ if canBuildRight(joinType) && canBuildLeft(joinType)
+ && left.stats.hints.broadcast && right.stats.hints.broadcast =>
+ if (right.stats.sizeInBytes <= left.stats.sizeInBytes) {
+ Seq(joins.BroadcastHashJoinExec(
+ leftKeys, rightKeys, joinType, BuildRight, condition,
planLater(left), planLater(right)))
+ } else {
+ Seq(joins.BroadcastHashJoinExec(
+ leftKeys, rightKeys, joinType, BuildLeft, condition,
planLater(left), planLater(right)))
+ }
--- End diff --
Just need to do something like
```
val buildSide = if (right.stats.sizeInBytes <= left.stats.sizeInBytes)
BuildRight else BuildLeft
Seq(joins.BroadcastHashJoinExec(
leftKeys, rightKeys, joinType, buildSide, condition, planLater(left),
planLater(right)))
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]