ConeyLiu commented on code in PR #37565:
URL: https://github.com/apache/spark/pull/37565#discussion_r953895575
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -769,6 +783,13 @@ object LimitPushDown extends Rule[LogicalPlan] {
// Push down local limit 1 if join type is LeftSemiOrAnti and join
condition is empty.
case j @ Join(_, right, LeftSemiOrAnti(_), None, _) if
!right.maxRows.exists(_ <= 1) =>
j.copy(right = maybePushLocalLimit(Literal(1, IntegerType), right))
+
+ case GlobalLimit(l, proj @ Project(projectList, child)) if
canPushLimitThroughProject(proj) =>
+ Project(projectList, GlobalLimit(l, child))
+ case LocalLimit(l, proj @ Project(projectList, child)) if
canPushLimitThroughProject(proj) =>
+ Project(projectList, LocalLimit(l, child))
+ case Limit(l, proj @ Project(projectList, child)) if
canPushLimitThroughProject(proj) =>
+ Project(projectList, Limit(l, child))
Review Comment:
Thanks, @wangyum. This is a really much better solution. The failed python
ut should be fixed by this update.
--
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]