You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/17 07:30:47 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #31857: [SPARK-28220][SQL] Push down the foldable predicate to both sides of Join

cloud-fan commented on a change in pull request #31857:
URL: https://github.com/apache/spark/pull/31857#discussion_r595769778



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -1457,8 +1457,9 @@ object PushPredicateThroughJoin extends Rule[LogicalPlan] with PredicateHelper {
     val (pushDownCandidates, nonDeterministic) = condition.partition(_.deterministic)
     val (leftEvaluateCondition, rest) =
       pushDownCandidates.partition(_.references.subsetOf(left.outputSet))
-    val (rightEvaluateCondition, commonCondition) =
-        rest.partition(expr => expr.references.subsetOf(right.outputSet))
+    val (rightEvaluateCondition, _) =
+        pushDownCandidates.partition(_.references.subsetOf(right.outputSet))
+    val commonCondition = rest.filterNot(e => rightEvaluateCondition.exists(_.semanticEquals(e)))

Review comment:
       seems safer to use `rest.filterNot(_.references.subsetOf(right.outputSet))`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org