You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
❯ selectsum(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:
❯ selectavg(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:
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
:But it does not work for
avg
: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 ofretract_batch
, similar to this implementation forSumAccumulator
:https://github.com/apache/arrow-datafusion/blob/3cc607de4ce6e9e1fd537091e471858c62f58653/datafusion/physical-expr/src/aggregate/sum.rs#L256-L262
The text was updated successfully, but these errors were encountered: