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 2022/08/24 09:50:10 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #37625: [SPARK-40177][SQL] Simplify join condition of form (a==b) || (a==null&&b==null) to a<=>b

cloud-fan commented on code in PR #37625:
URL: https://github.com/apache/spark/pull/37625#discussion_r953590635


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -306,6 +306,47 @@ object OptimizeIn extends Rule[LogicalPlan] {
   }
 }
 
+/**
+ * SimplifyJoinCondition:
+ * Changes the join condition of type (key1=key2) || (isnull(key1)&&isnull(key2))
+ * to key1 <=> key2 to prevent join from converting to BNLJ in physical planning
+ * which is costly implementation of join.
+ */
+object SimplifyJoinCondition extends Rule[LogicalPlan] with PredicateHelper {
+  override def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
+    _.containsPattern(JOIN), ruleId) {
+    case join@Join(_, _, _, Some(joinCondition), _) =>

Review Comment:
   I think it's beneficial for `Filter` as well?



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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