samueleresca commented on issue #17269: URL: https://github.com/apache/datafusion/issues/17269#issuecomment-3234944839
This issue is also affecting other aggregates (e.g. `sum()`). I think the root cause is the parsing between `ScalarValue` to `ArrayRef` happening at the finalisation of the aggregation. The `evaluate` function of `TrivialFirstValueAccumulator`, `FirstValueAccumulator`, etc., produces a `ScalarValue`. The `ScalarValue` is parsed to `ArrayRef` in `finalize_aggregation`: https://github.com/apache/datafusion/blob/d19bf524e384bc24e509c70f1806b6f330829529/datafusion/physical-plan/src/aggregates/mod.rs#L1341-L1344 The `.to_array()` function is always setting the size of the Array to `1`: https://github.com/apache/datafusion/blob/d19bf524e384bc24e509c70f1806b6f330829529/datafusion/common/src/scalar/mod.rs#L2042-L2044 -- 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]
