cloud-fan opened a new pull request, #59758: URL: https://github.com/apache/spark/pull/59758
### What changes were proposed in this pull request? This is a followup of https://github.com/apache/spark/pull/57742. When adaptive partial aggregation bypasses the partial aggregation, each passed-through row starts from a fresh initial aggregation buffer. The generated code builds that buffer inline, in the per-row consume method of the aggregation. This PR moves the projection into its own generated method, `makeEmptyAggBuffer()`, which the pass-through branch calls. The generated code is otherwise unchanged. ### Why are the changes needed? The initial-buffer projection writes one value per aggregation buffer slot, so its code grows with the number of aggregate functions. Inlined, that code lands in the per-row consume method of every eligible aggregation, although it only runs once pass-through is active. For a wide aggregation it can push the consume method past HotSpot's size limit for JIT-compiling a method (8000 bytes of bytecode by default), which leaves the hottest per-row loop interpreted. Generating the projection in its own method keeps that cost out of the consume method. ### Does this PR introduce _any_ user-facing change? No. It only changes the layout of the generated code. Adaptive partial aggregation is new in the unreleased 4.4.0 and disabled by default. ### How was this patch tested? Existing tests. `AdaptivePartialAggregationSuite` exercises the pass-through path with whole-stage codegen on and off, the two-level map on and off, and with and without spills, and compares every result against a run with the feature disabled. `build/sbt "sql/testOnly *AdaptivePartialAggregationSuite"` passes. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) This pull request and its description were written by Isaac. -- 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]
