cloud-fan commented on a change in pull request #31908: URL: https://github.com/apache/spark/pull/31908#discussion_r643622282
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala ########## @@ -165,6 +170,23 @@ object EliminateOuterJoin extends Rule[LogicalPlan] with PredicateHelper { case f @ Filter(condition, j @ Join(_, _, RightOuter | LeftOuter | FullOuter, _, _)) => val newJoinType = buildNewJoinType(f, j) if (j.joinType == newJoinType) f else Filter(condition, j.copy(joinType = newJoinType)) + + case a @ Aggregate(_, _, join @ Join(left, _, LeftOuter, _, _)) + if a.isDistinct && a.references.subsetOf(AttributeSet(left.output)) && + !canPlanAsBroadcastHashJoin(join, conf) => Review comment: Sorry I missed this. It's outer join and it will never reduce data volume of the left side. So we can always remove the join, no matter it's broadcast or not. -- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org