-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I would like DataFusion to support using the avg aggregate function in a window with custom frame.
Here is a working example using sum:
❯ select sum(column1) OVER(ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) from (values (1.0), (2.0), (3.0)) as sq;
+-----------------+
| SUM(sq.column1) |
+-----------------+
| 1 |
| 3 |
| 5 |
+-----------------+But it does not work for avg:
❯ select avg(column1) OVER(ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) from (values (1.0), (2.0), (3.0)) as sq;
ArrowError(ExternalError(ArrowError(ExternalError(NotImplemented("Retractable Accumulator hasn't been implemented for Avg { name: \"AVG(sq.column1)\", expr: Column { name: \"column1\", index: 0 }, data_type: Float64 } yet")))))Describe the solution you'd like
I would like avg to support use in windows with custom frames.
Additional context
Looking at the implementation briefly, I think AvgAccumulator needs an implementation of retract_batch, similar to this implementation for SumAccumulator:
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request