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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to