zifeif2 opened a new pull request, #59409:
URL: https://github.com/apache/spark/pull/59409

   ### What changes were proposed in this pull request?
   
   Preserve server-rendered error messages in the Scala Spark Connect client 
when the server's condition is absent from the client's error registry. The 
fallback retains the mapped exception type, condition, message parameters, 
SQLSTATE, query context, cause, and server stack trace.
   
   Add internal construction paths for the affected exception types. Conditions 
known to the client retain their existing rendering, and errors without a 
condition retain their existing legacy fallback.
   
   ### Why are the changes needed?
   
   Connector-specific conditions and conditions introduced by newer servers may 
not exist in the client's core error catalog. The converter currently tries to 
render those conditions locally and throws `INTERNAL_ERROR`, hiding the 
original server failure even though its message was received successfully.
   
   For example, the Kafka invalid-offset conditions discussed in 
https://github.com/apache/spark/pull/59219#discussion_r4216170281 trigger this 
problem. This fix is based directly on master and can land before that Kafka PR.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A Scala Connect client receiving an unknown structured condition now 
exposes the server's actionable message and metadata through the corresponding 
exception type. For the Kafka invalid-offset example, this preserves 
`IllegalArgumentException` and SQLSTATE `22023` instead of replacing them with 
`INTERNAL_ERROR` / `XX000`.
   
   ### How was this patch tested?
   
   The following focused tests passed (51 tests total):
   
   - `connect-client-jvm/testOnly *SparkConnectClientSuite -- -z error` (10 
tests)
   - `common-utils/testOnly *StreamingQueryExceptionSuite` (3 tests)
   - `core/testOnly *SparkThrowableSuite` (38 tests)
   
   Coverage includes all 18 mapped exception types with unknown conditions and 
unknown subclasses, with and without SQLSTATE; enriched Kafka offset errors 
with causes, query contexts, and server stack traces; and the ErrorInfo 
fallback with truncated parameters.
   
   Additional validation:
   
   - Scalafmt validation passed for SQL API, Connect common, and Connect client.
   - `dev/connect-jvm-client-mima-check` passed, including compilation of the 
final source and test code.
   - Scalastyle passed for common-utils, SQL API, Connect common, and Connect 
client tests.
   - `git diff --check` passed.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6)
   


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