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/02/24 08:44:12 UTC

[GitHub] [spark] zhengruifeng commented on a change in pull request #35194: [SPARK-37899][SQL] EliminateInnerJoin to support convert inner join to left semi join

zhengruifeng commented on a change in pull request #35194:
URL: https://github.com/apache/spark/pull/35194#discussion_r813659957



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala
##########
@@ -187,6 +187,23 @@ object EliminateOuterJoin extends Rule[LogicalPlan] with PredicateHelper {
   }
 }
 
+/**
+ * Convert inner join to left semi join.
+ */
+object EliminateInnerJoin extends Rule[LogicalPlan] with PredicateHelper with JoinSelectionHelper {
+  def apply(plan: LogicalPlan): LogicalPlan = {
+    plan.transformWithPruning(_.containsPattern(INNER_LIKE_JOIN), ruleId) {
+      case p @ Project(_,
+          j @ ExtractEquiJoinKeys(Inner, _, rightKeys, None, _, left, right: Aggregate, _))

Review comment:
       Inner join is symmetrical, can this rule also be applied to inner join with left `Aggregate` child?
   
   `j @ ExtractEquiJoinKeys(Inner, leftKeys, _, _, None, left: Aggregate, _, _))`




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