alamb opened a new pull request, #8925: URL: https://github.com/apache/arrow-datafusion/pull/8925
DRAFT as I want to test if it would be better to take `self` rather than &mut self ## Which issue does this PR close? Part of https://github.com/apache/arrow-datafusion/issues/5472 ## Rationale for this change As part of https://github.com/apache/arrow-datafusion/pull/8849, I realized I couldn't implement a zero copy algorithm because `evaluate` and `merge` take a `&self` not a `&mut self`. This is unlikely to matter for most `Accumulators` as they only emit a single scalar value, but for ones that emit significant internal state (like count `DISTINCT`) using the same internal state can save a lot of copying Also, the actual 1Accumulator` instances are never used after a call to evaluate/state so they can be passed mut. This is also consistent with `GroupsAccumuulator` which takes mut for its state and evaluate functions (TODO get references) ## What changes are included in this PR? 1. Change `Accumulator::evaluate` and `Accumulator::state` to take `&mut self` 2. Update all uses ## Are these changes tested? Covered by existing tests ## Are there any user-facing changes? Yes, the signature of user defined Accumulators needs to be changed to take `&mut self` -- 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]
