yaooqinn opened a new pull request, #54553:
URL: https://github.com/apache/spark/pull/54553
### What changes were proposed in this pull request?
On JDK 25, `Math.multiplyExact`/`Math.addExact` may throw
`ArithmeticException` without a message (null instead of `"long overflow"`).
This causes `NullPointerException` in tests that check the raw exception
message via `.getMessage.contains(...)`.
This PR:
1. **`MathUtils.withOverflow`**: Provides a fallback message `"Overflow"`
when the raw JDK exception message is null, preventing null propagation into
Spark error conditions (both interpreted and codegen paths).
2. **Test assertions**: Makes raw `ArithmeticException` message checks
null-safe across:
- `DateExpressionsSuite` (line 1825)
- `CatalystTypeConvertersSuite` (line 305)
- `DateTimeUtilsSuite` (line 835)
- `IntervalUtilsSuite` (line 593)
- `TimestampFormatterSuite` (lines 451, 453)
### Why are the changes needed?
The JDK 25 scheduled CI build fails with:
```
java.lang.NullPointerException: Cannot invoke
"String.contains(java.lang.CharSequence)" because
"$org_scalatest_assert_macro_left" is null
at DateExpressionsSuite.scala:1825
```
See: https://github.com/apache/spark/actions/runs/22513372344/job/65226962993
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing tests pass on JDK 17. The `MathUtils.withOverflow` fix ensures
non-null messages regardless of JDK version.
### Was this patch authored or co-authored using generative AI tooling?
Yes, co-authored with GitHub Copilot.
--
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]