gengliangwang opened a new pull request, #56063: URL: https://github.com/apache/spark/pull/56063
### What changes were proposed in this pull request? Introduce `DecimalExpressionUtils.java` with a `checkOverflowInSum(Decimal, int, int, boolean, QueryContext)` static helper and call it from `CheckOverflowInSum.doGenCode` and the eval path. Codegen body shrinks from a 10-line if/else block (init `ev.value` to null, branch on `childGen.isNull`, conditionally throw, conditionally call `toPrecision` + re-set `ev.isNull`) to 4 lines (single helper call + post-check). Eval is now a single delegating call. ### Why are the changes needed? Part of SPARK-56908 (umbrella). `CheckOverflowInSum` is emitted around every decimal `Sum` and is one of the longer remaining inline ANSI bodies. Collapsing the per-call-site body shrinks generated Java source and Janino compile time on aggregation-heavy plans. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? ``` build/sbt "catalyst/testOnly *DecimalExpressionSuite *AggregateExpressionSuite" build/sbt "sql/testOnly *DataFrameAggregateSuite -- -z sum" ``` 20/20 pass (incl. the SPARK-39208 `CheckOverflowInSum` runtime-context test). ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Cursor 1.x -- 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]
