Describe the bug
Some analytical functions effect the effective window bounds by adding a lookahead (acausal) amount of rows. The current implementation of LimitPushPastWindows does not take this into account, does not grow the limit by the appropriate amount, and does not give them the input data necessary to compute the correct totals.
To Reproduce
Run a query like:
SELECT LEAD(empno) OVER (ORDER BY empno ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM employees LIMIT 3
with datafusion.optimizer.enable_window_limits enabled/disabled to observe different results.
Expected behavior
No response
Additional context
No response