dongjoon-hyun commented on a change in pull request #31691:
URL: https://github.com/apache/spark/pull/31691#discussion_r594592518
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -625,6 +626,37 @@ object LimitPushDown extends Rule[LogicalPlan] {
}
}
+/**
+ * Pushes down [[LocalLimit]] beneath WINDOW.
+ */
+object LimitPushDownThroughWindow extends Rule[LogicalPlan] {
+ // The window frame of RankLike and RowNumberLike can only be UNBOUNDED
PRECEDING to CURRENT ROW.
+ private def supportsPushdownThroughWindow(
+ windowExpressions: Seq[NamedExpression]): Boolean =
windowExpressions.forall {
+ case Alias(WindowExpression(_: RankLike | _: RowNumberLike,
+ WindowSpecDefinition(Nil, _,
Review comment:
If you don't mind, can we merge line 636 and 637?
```scala
case Alias(WindowExpression(_: RankLike | _: RowNumberLike,
WindowSpecDefinition(Nil, _,
SpecifiedWindowFrame(RowFrame, UnboundedPreceding, CurrentRow))), _) =>
true
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]