Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/5612#discussion_r28827377
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala ---
@@ -36,12 +36,14 @@ private[sql] abstract class SparkStrategies extends
QueryPlanner[SparkPlan] {
def apply(plan: LogicalPlan): Seq[SparkPlan] = plan match {
case ExtractEquiJoinKeys(LeftSemi, leftKeys, rightKeys, condition,
left, right)
if sqlContext.conf.autoBroadcastJoinThreshold > 0 &&
- right.statistics.sizeInBytes <=
sqlContext.conf.autoBroadcastJoinThreshold =>
+ right.statistics.sizeInBytes <=
sqlContext.conf.autoBroadcastJoinThreshold &&
+ canEvaluate(condition.getOrElse(Literal(true)), left) =>
val semiJoin = joins.BroadcastLeftSemiJoinHash(
leftKeys, rightKeys, planLater(left), planLater(right))
condition.map(Filter(_, semiJoin)).getOrElse(semiJoin) :: Nil
// Find left semi joins where at least some predicates can be
evaluated by matching join keys
- case ExtractEquiJoinKeys(LeftSemi, leftKeys, rightKeys, condition,
left, right) =>
+ case ExtractEquiJoinKeys(LeftSemi, leftKeys, rightKeys, condition,
left, right)
+ if canEvaluate(condition.getOrElse(Literal(true)), left) =>
--- End diff --
I don't think this is the best solution as you are going to fall back to
broadcasting, even when there are equality keys that can be used for hashing.
This will OOM when both sides are large. Instead, I think that you should add
a case that tries to plan a HashJoin, but throws out the right output.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]