wangyum commented on pull request #31691:
URL: https://github.com/apache/spark/pull/31691#issuecomment-797160869


   +1 for add an independent rule. It seems we can pushdown more cases. For 
example:
   1. Window function with `PARTITION BY`:
   ```sql
   SELECT *, ROW_NUMBER() OVER(PARTITION BY a ORDER BY b) AS rn FROM t LIMIT 10 
=>
   SELECT *, ROW_NUMBER() OVER(PARTITION BY a ORDER BY b) AS rn FROM (SELECT * 
FROM t ORDER BY a, b LIMIT 10) tmp
   ```
   2. Window function with predicate:
   ```sql
   SELECT * FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY a ORDER BY b) AS rn 
FROM t ) tmp where rn < 100 LIMIT 10 =>
   SELECT *, ROW_NUMBER() OVER(PARTITION BY a ORDER BY b) AS rn FROM (SELECT * 
FROM t ORDER BY a, b LIMIT 10) tmp
   
   ```
   


----------------------------------------------------------------
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]

Reply via email to