Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/6780#discussion_r32301095
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -107,6 +108,17 @@ object UnionPushdown extends Rule[LogicalPlan] {
}
}
+object LimitPushDown extends Rule[LogicalPlan] {
+ def apply(plan: LogicalPlan): LogicalPlan = plan transform {
+ // Push down limit when the child is project on limit
+ case Limit(expr, Project(projectList, l: Limit)) =>
+ Project(projectList, Limit(expr, l))
+
+ // Push down limit when the child is project on sort
+ case Limit(expr, Project(projectList, s: Sort)) =>
+ Project(projectList, Limit(expr, s))
+ }
--- End diff --
This is for SPARK-7289. As we discussed in
https://github.com/apache/spark/pull/5821, we need an optimize rule like this.
cc @adrian-wang
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]