haoyangeng-db opened a new pull request, #55992:
URL: https://github.com/apache/spark/pull/55992

   ### What changes were proposed in this pull request?
   
   Null-guard `sparkThrowableBuilder.putAllMessageParameters` in 
`ErrorUtils.throwableToProtoErrors` (Spark Connect server). If a 
`SparkThrowable` implementation returns `null` from `getMessageParameters()`, 
the unguarded call to `putAllMessageParameters(null)` throws a 
`NullPointerException`. With the guard, a `null` map is treated the same as an 
empty one.
   
   ### Why are the changes needed?
   
   The `SparkThrowable` interface's default `getMessageParameters` returns an 
empty map, but an override may violate that implicit non-null contract. When it 
does, the resulting NPE inside `FetchErrorDetails` server-side serialization 
crashes the RPC, and the client falls back to a degraded error reconstruction 
that drops the cause chain, hiding the underlying error from the user.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Well-behaved `SparkThrowable` implementations are unaffected. A faulty 
override that returns `null` now serializes with an empty `messageParameters` 
map instead of crashing the RPC.
   
   ### How was this patch tested?
   
   Added a regression test in `FetchErrorDetailsHandlerSuite` that uses an 
inline `SparkThrowable` whose `getMessageParameters` returns `null` and 
verifies the response is built successfully with an empty `messageParameters` 
map.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Drafted with Claude Code
   


-- 
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]

Reply via email to