ulysses-you commented on a change in pull request #27048: [SPARK-30386][SQL]
Pushdown limit to outer join through projects
URL: https://github.com/apache/spark/pull/27048#discussion_r362376835
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -495,6 +495,18 @@ object LimitPushDown extends Rule[LogicalPlan] {
case _ => join
}
LocalLimit(exp, newJoin)
+ // Pushdown limit to outer join through projects if projects are
deterministic.
+ case l @ LocalLimit(exp, proj @ Project(projs, join @ Join(left, right,
joinType, _, _))) =>
Review comment:
It pushed. When execute `explain extended select c from test union all
select c from test limit 1`, the optimized plan is
```
GlobalLimit 1
+- LocalLimit 1
+- Union
:- LocalLimit 1
: +- Relation[c#50] parquet
+- LocalLimit 1
+- Relation[c#50] parquet
```
The difference is another optimizer `PushProjectionThroughUnion` has pushed
down `Project`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]