Skip to content

[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
eason-yuchen-liu:fix-streaming-query-exception-npe
Open

[SPARK-56092][SS][CONNECT] Fix NPE in StreamingQueryException.toString() when cause is null#54914
eason-yuchen-liu wants to merge 2 commits intoapache:masterfrom
eason-yuchen-liu:fix-streaming-query-exception-npe

Conversation

@eason-yuchen-liu
Copy link
Contributor

@eason-yuchen-liu eason-yuchen-liu commented Mar 20, 2026

What changes were proposed in this pull request?

Fix a NullPointerException in StreamingQueryException.toString() when cause is null.

Why are the changes needed?

When a StreamingQueryException is reconstructed on the Spark Connect client side via GrpcExceptionConverter.errorFactory, the cause field can 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 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 when cause is null.

How was this patch tested?

This should be a simple rewrite.

Was this patch authored or co-authored using generative AI tooling?

Yes.

…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
@eason-yuchen-liu eason-yuchen-liu marked this pull request as draft March 20, 2026 02:26
@eason-yuchen-liu eason-yuchen-liu changed the title [SPARK-XXXXX][SS][CONNECT] Fix NPE in StreamingQueryException.toString() when cause is null [SPARK-56092][SS][CONNECT] Fix NPE in StreamingQueryException.toString() when cause is null Mar 20, 2026
@eason-yuchen-liu eason-yuchen-liu marked this pull request as ready for review March 20, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant