wangyum commented on a change in pull request #31691:
URL: https://github.com/apache/spark/pull/31691#discussion_r594894009
##########
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.
Review comment:
Yes, I plan explain it by SQL,
```scala
/**
* Pushes down [[LocalLimit]] beneath WINDOW. This rule optimizes the
following case:
* {{{
* SELECT *, ROW_NUMBER() OVER(ORDER BY a) AS rn FROM Tab1 LIMIT 5 ==>
* SELECT *, ROW_NUMBER() OVER(ORDER BY a) AS rn FROM (SELECT * FROM Tab1
ORDER BY a LIMIT 5) t
* }}}
*/
```
----------------------------------------------------------------
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]