Chetansahney opened a new pull request, #27991: URL: https://github.com/apache/datafusion/pull/27991
## Which issue does this PR close? - Closes #27183. This continues #27184 by @s5dsn-eqee, which @getChan approved but which was closed after it picked up merge conflicts. It is the same change rebased onto `main` (the upgrade note moved into the single `upgrading/index.md`), with @s5dsn-eqee as co-author. ## Rationale for this change `array_sum` returns `Float64` for every input, so integer sums above 2^53 and decimal sums are silently rounded, while the `sum` aggregate over the same values is exact: ```sql SELECT array_sum([9007199254740993, 1]); -- 9007199254740992 (Float64) SELECT sum(v) FROM (VALUES (9007199254740993), (1)) t(v); -- 9007199254740994 (Int64) ``` ## What changes are included in this PR? - `array_sum` coerces elements to the type `sum` accumulates in (64-bit integers, decimals unchanged, everything else `Float64`) and takes its return type from `Sum::return_type`, as suggested in the review of #27184, so the two can't drift apart. - Each row is summed with `arrow::compute::sum`, the kernel the `sum` aggregate uses: NULL elements are skipped, empty and all-NULL rows return NULL, and integer overflow wraps. - Upgrade guide entry and regenerated function docs. ## What is the testing strategy for this PR? `array_sum.slt` covers signed and unsigned integers past 2^53, decimals (including precision widening), floats, NULL handling, overflow wrapping, and `LargeList`/`FixedSizeList` inputs. The file fails with 8 errors on `main` and passes with this change. `cargo test -p datafusion-functions-nested --lib` (162 passed), `cargo fmt --all` and `cargo clippy -p datafusion-functions-nested --all-targets --all-features -- -D warnings` pass. ## Are there any user-facing changes? Yes: `array_sum` now returns `Int64`, `UInt64` or a widened decimal for integer and decimal arrays instead of `Float64`. This is described in the upgrade guide. It's a change to SQL behavior, not to a Rust API. --- AI assistance: I used Claude Code (Claude Opus 5.5) to rebase #27184 onto `main`, place the upgrade note and run the checks. I reviewed the full diff and can answer questions about it. -- 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]
