You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "yaooqinn (via GitHub)" <gi...@apache.org> on 2026/02/28 05:13:28 UTC
[PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn closed pull request #54553: [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25
URL: https://github.com/apache/spark/pull/54553
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3976634318
I'm not sure in this case because this one looks more concise. Does this make all tests pass? Could you talk with @pan3793 ?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3976444730
Oh, I didn't notice there's existing effort, just saw an error the master branch and proposed this fix. Shall I close this one? @dongjoon-hyun
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3977416044
Sounds good, @yaooqinn . Thanks.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3977292600
Let me merge this to fix some CI failures first, thank you @dongjoon-hyun
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3977443672
@yaooqinn this change is insufficient to cover all ArithmeticException null message cases. I suggest you review https://github.com/apache/spark/pull/54514 in instead of hurrying to merge this one.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3977455216
FYI, I have a draft PR https://github.com/apache/spark/pull/54091 which makes all GHA pipeline pass on JDK 25. You check each commit to evaluate the remaining issue.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3977466570
@pan3793, my apologies, feel free to revert this one if you've gotten a better plan.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #54553:
URL: https://github.com/apache/spark/pull/54553#discussion_r2867667225
##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/MathUtils.scala:
##########
@@ -94,7 +94,9 @@ object MathUtils {
f
} catch {
case e: ArithmeticException =>
- throw ExecutionErrors.arithmeticOverflowError(e.getMessage, hint, context)
+ // On JDK 25+, Math.*Exact may throw ArithmeticException without a message
+ val message = if (e.getMessage != null) e.getMessage else "Overflow"
+ throw ExecutionErrors.arithmeticOverflowError(message, hint, context)
Review Comment:
changing here causes duplication, why not do it in `ExecutionErrors.arithmeticOverflowError` like https://github.com/apache/spark/pull/54514?
in addition, better to use lower case "overflow" to match the original JDK message style
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3976435582
BTW, did you split the scope disjointly from the following PR, @yaooqinn ?
- #54514
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55755][SQL][TESTS] Handle null ArithmeticException message on JDK 25 [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #54553:
URL: https://github.com/apache/spark/pull/54553#issuecomment-3977490790
Okay, reverted in 3f54ac5c665c09cadc2334c7087361201444ffd2, JIRA is updated to "duplicate with SPARK-55714"
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org