linhongliu-db commented on code in PR #59962:
URL: https://github.com/apache/spark/pull/59962#discussion_r4554423992
##########
docs/sql-migration-guide.md:
##########
@@ -29,6 +29,8 @@ license: |
## Upgrading from Spark SQL 4.3 to 4.4
+- Since Spark 4.4, `SQLException`s from destination JDBC calls during executor
partition writes are classified through the JDBC dialect. This includes
executor connection acquisition and write setup. Initial driver-side connection
acquisition and table setup retain their existing error propagation. When a
dialect has no more specific mapping, the failure is a `SparkRuntimeException`
with condition `FAILED_JDBC.WRITE` and SQLSTATE `HV000`, rather than an
unclassified `SQLException` inside a job-aborted `SparkException`. The write
path also normalizes the default legacy classifier's generic
`FAILED_JDBC.UNCLASSIFIED` result to this runtime condition. Dialect-specific
mappings, including those in built-in dialects, can return other conditions.
Spark Connect projects `FAILED_JDBC.WRITE` to `FAILED_JDBC.UNCLASSIFIED` so
clients with older error catalogs can reconstruct it; other conditions are
unchanged. Update handlers that catch `SparkException` or match the driver's
text in the top-le
vel message: use the public `SparkThrowable` interface to inspect the
condition and SQLSTATE. The `FAILED_JDBC.WRITE` wrapper retains the original
vendor message and SQLSTATE on its cause; its top-level `HV000` does not
distinguish a constraint violation from a transient database failure. Source
iterator errors and task interruption remain unclassified by the write path.
Review Comment:
Addressed: clarified the Spark-driver and JDBC-vendor wording in the
migration note.
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCWriteSuite.scala:
##########
@@ -570,10 +570,20 @@ class JDBCWriteSuite extends SharedSparkSession with
BeforeAndAfter {
}
test("SPARK-19726: INSERT null to a NOT NULL column") {
- val e = intercept[SparkException] {
- sql("INSERT INTO PEOPLE1 values (null, null)")
- }.getMessage
- assert(e.contains("NULL not allowed for column \"NAME\""))
+ val e = intercept[SparkRuntimeException] {
Review Comment:
Addressed: updated the ignored timeout test for FAILED_JDBC.WRITE.
--
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]