avantgardnerio opened a new issue, #17346:
URL: https://github.com/apache/datafusion/issues/17346

   ### Is your feature request related to a problem or challenge?
   
   Window functions are cardinality preserving, they just might need to see 
more data than the limits applied after them, so we should be able to push 
limits down through them, assuming we know how to grow the limits appropriately.
   
   ### Describe the solution you'd like
   
   This is fairly trivial if `WindowFrameUnits::Rows`, so let's start there. 
Assume we have a plan like:
   
   ```
   GlobalLimitExec fetch=5
   --BoundedWindowAggExec:[sum(c4) ORDER BY [c4 ASC] ROWS BETWEEN 1 PRECEDING 
AND 1 FOLLOWING 
   ----SortExec: expr=[c4@0 ASC NULLS LAST], preserve_partitioning=[false]
   ```
   
   We should be able to transform it into:
   ```
   GlobalLimitExec fetch=5
   --BoundedWindowAggExec:[sum(c4) ORDER BY [c4 ASC] ROWS BETWEEN 1 PRECEDING 
AND 1 FOLLOWING 
   ----SortExec: TopK(fetch=7), expr=[c4@0 ASC NULLS LAST], 
preserve_partitioning=[false]
   ```
   
   
   ### Describe alternatives you've considered
   
   Ignore opportunities like this.
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to