kmitchener opened a new issue, #2869:
URL: https://github.com/apache/arrow-datafusion/issues/2869

   **Describe the bug**
   A clear and concise description of what the bug is.
   
   Was attempting to concisely calculate growth rates using window functions. 
Queries like this:
   
   ```sql
   select col1, idx, count(*), sum(amount), lag(sum(amount), 1) over (order by 
idx) as prev_amount, 
   sum(amount) - lag(sum(amount), 1) over (order by idx) as difference from (
   select * from (values ('a', 1, 100), ('a', 2, 150)) as t (col1, idx, amount)
   ) a 
   group by col1, idx;
   ```
   or 
   ```sql
   select 1 - lag(amount, 1) over (order by idx) from (values ('a', 1, 100), 
('a', 2, 150)) as t (col1, idx, amount)
   ```
   Results in 
   ```
   NotImplemented("Physical plan does not support logical expression 
LAG(#SUM(a.amount), Int64(1)) ORDER BY [#a.idx ASC NULLS LAST]")
   ```
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   use a window function in an expression
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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...@arrow.apache.org.apache.org

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

Reply via email to