[SPARK-56092][SS][CONNECT] Fix NPE in StreamingQueryException.toString() when cause is null#54914
Open
eason-yuchen-liu wants to merge 2 commits intoapache:masterfrom
Open
Conversation
…is null When a StreamingQueryException is reconstructed on the SparkConnect client side via GrpcExceptionConverter, the cause may be null (params.cause.orNull). The toString() method unconditionally calls cause.getMessage, which throws a NullPointerException. This can crash the Scala kernel when it tries to log the exception, masking the actual streaming query failure. Co-authored-by: Isaac
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?
Fix a
NullPointerExceptioninStreamingQueryException.toString()whencauseis null.Why are the changes needed?
When a
StreamingQueryExceptionis reconstructed on the Spark Connect client side viaGrpcExceptionConverter.errorFactory, thecausefield can be null (params.cause.orNull). ThetoString()method unconditionally callscause.getMessage, which throws aNullPointerException.This can crash the Scala kernel when it tries to log the exception, masking the actual streaming query failure with an unresponsive kernel error.
Does this PR introduce any user-facing change?
No. This is a bug fix in error handling —
toString()will now return a meaningful message instead of throwing an NPE whencauseis null.How was this patch tested?
This should be a simple rewrite.
Was this patch authored or co-authored using generative AI tooling?
Yes.