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

   ### What changes were proposed in this pull request?
   
   Classify non-interrupted JDBC write failures from `JdbcUtils.savePartition` 
through the active dialect as `FAILED_JDBC.WRITE` (SQLSTATE `HV000`). Keep the 
original `SQLException` as the cause, including its next-exception chain. 
Preserve cancellation exceptions and existing dialect classifications.
   
   ### Why are the changes needed?
   
   JDBC batch write failures currently propagate without a Spark error 
condition or SQLSTATE. Classification makes the write failure identifiable 
while retaining the driver's diagnostic details.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, for failed JDBC writes: the reported error now includes 
`FAILED_JDBC.WRITE` and SQLSTATE `HV000`. Successful writes and task 
cancellation behavior are unchanged.
   
   ### How was this patch tested?
   
   Added `JdbcTaskInterruptSuite` cases for modern and legacy JDBC dialects, 
and updated the H2 failure assertion in `JDBCWriteSuite` to check the 
condition, SQLSTATE, and original driver exception. Locally passed 38 JDBC 
tests and 38 `SparkThrowableSuite` tests (one JDBC test ignored); dependency 
resolution used Java 17 and the internal Maven mirror.
   
   ```bash
   build/sbt 'sql/testOnly 
org.apache.spark.sql.execution.datasources.jdbc.JdbcTaskInterruptSuite 
org.apache.spark.sql.jdbc.JDBCWriteSuite' 'core/testOnly 
org.apache.spark.SparkThrowableSuite'
   ```
   
   ### 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