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

   ### Describe the bug
   
   Bounded sliding window queries using `covar_pop`, `covar_samp`, and `corr` 
fail with a "retract_batch is not implemented" error, even though these 
aggregates otherwise work correctly.
   
   ### To Reproduce
   
   ```sql
   CREATE TABLE sliding_corr_test AS
   VALUES
     (1, 10.0),
     (2, 20.0),
     (3, 30.0);
   
   SELECT
     column1,
     covar_pop(column2, column2) OVER (
       ORDER BY column1
       ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING
     ) AS cp,
     covar_samp(column2, column2) OVER (
       ORDER BY column1
       ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING
     ) AS cs,
     corr(column2, column2) OVER (
       ORDER BY column1
       ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING
     ) AS c
   FROM sliding_corr_test;
   ```
   
   ### Expected behavior
   
   The query should execute successfully and return covariance/correlation 
values for the specified window frame, similar to how other aggregates that 
support bounded sliding windows behave.
   
   ### Additional context
   
   ## Actual Result
   
   ```text
   This feature is not implemented: Aggregate can not be used as a sliding 
accumulator because `retract_batch` is not implemented: 
covar_pop(sliding_corr_test.column2, sliding_corr_test.column2) ORDER BY 
[sliding_corr_test.column1 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 
PRECEDING
   ```
   
   The same error occurs for other bounded sliding frames, for example:
   
   ```sql
   ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING
   ```


-- 
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: [email protected]

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