Skip to content

Commit 14e4bf8

Browse files
author
kai
committed
Use CanBroadcast in broadcast outer join planning
1 parent dc5127e commit 14e4bf8

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,19 @@ private[sql] abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
117117
leftKeys, rightKeys, buildSide, planLater(left), planLater(right))
118118
condition.map(Filter(_, hashJoin)).getOrElse(hashJoin) :: Nil
119119

120+
case ExtractEquiJoinKeys(
121+
LeftOuter, leftKeys, rightKeys, condition, left, CanBroadcast(right)) =>
122+
joins.BroadcastHashOuterJoin(
123+
leftKeys, rightKeys, LeftOuter, condition, planLater(left), planLater(right)) :: Nil
124+
125+
case ExtractEquiJoinKeys(
126+
RightOuter, leftKeys, rightKeys, condition, CanBroadcast(left), right) =>
127+
joins.BroadcastHashOuterJoin(
128+
leftKeys, rightKeys, RightOuter, condition, planLater(left), planLater(right)) :: Nil
129+
120130
case ExtractEquiJoinKeys(joinType, leftKeys, rightKeys, condition, left, right) =>
121-
joinType match {
122-
case LeftOuter if sqlContext.conf.autoBroadcastJoinThreshold > 0 &&
123-
right.statistics.sizeInBytes <= sqlContext.conf.autoBroadcastJoinThreshold =>
124-
joins.BroadcastHashOuterJoin(
125-
leftKeys, rightKeys, joinType, condition, planLater(left), planLater(right)) :: Nil
126-
case RightOuter if sqlContext.conf.autoBroadcastJoinThreshold > 0 &&
127-
left.statistics.sizeInBytes <= sqlContext.conf.autoBroadcastJoinThreshold =>
128-
joins.BroadcastHashOuterJoin(
129-
leftKeys, rightKeys, joinType, condition, planLater(left), planLater(right)) :: Nil
130-
case _ =>
131-
joins.ShuffledHashOuterJoin(
132-
leftKeys, rightKeys, joinType, condition, planLater(left), planLater(right)) :: Nil
133-
}
131+
joins.ShuffledHashOuterJoin(
132+
leftKeys, rightKeys, joinType, condition, planLater(left), planLater(right)) :: Nil
134133

135134
case _ => Nil
136135
}

0 commit comments

Comments
 (0)