[SPARK-55714][SQL] JDK might throw ArithmeticException without message#54514
Open
pan3793 wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-55714][SQL] JDK might throw ArithmeticException without message#54514pan3793 wants to merge 1 commit intoapache:masterfrom
pan3793 wants to merge 1 commit intoapache:masterfrom
Conversation
| case null => "overflow" | ||
| case m if m.contains("overflow") => "overflow" | ||
| case m => m | ||
| } |
Member
There was a problem hiding this comment.
Can we use a simple Scala-style one-liner?
- val canonicalMessage = message match {
- // For "hot throws", the JIT will produce compiled code that does not
- // go through the interpreter via deoptimization to throw an exception
- // but throws a pre-allocated exception object without a stack trace
- // or message. See https://bugs.openjdk.org/browse/JDK-8367990
- case null => "overflow"
- case m if m.contains("overflow") => "overflow"
- case m => m
- }
+ val canonicalMessage = Option(message).filterNot(_.contains("overflow")).getOrElse("overflow")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Canonicalize the error message of
SparkArithmeticException:Update tests to accept null message from
ArithmeticExceptionWhy are the changes needed?
During test, I found JDK 25 might throw
ArithmeticExceptionwithnullmessage, and it varies on different platforms / CPU models, for example, it's different on Apple M1 and x86 Server, and even different on Intel Skylake and AMD Zen4 (both are x86 but with different instructions support)https://bugs.openjdk.org/browse/JDK-8367990
Does this PR introduce any user-facing change?
Some
ARITHMETIC_OVERFLOWerror condition message changes from "byte overflow", "long overflow", etc., to "overflow".How was this patch tested?
Pass GHA for JDK 17. JDK 25 will be covered by daily tests.
Was this patch authored or co-authored using generative AI tooling?
No, the patch is crafted by hand.