This is an automated email from the ASF dual-hosted git repository.
wenchen pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new d1b7386e267e [SPARK-54800] Changed default implementation for
isObjectNotFoundException
d1b7386e267e is described below
commit d1b7386e267e6d06e96612f9d663c971b696ff06
Author: Stefan Savić <[email protected]>
AuthorDate: Tue Dec 23 00:07:20 2025 +0800
[SPARK-54800] Changed default implementation for isObjectNotFoundException
### What changes were proposed in this pull request?
Changed that `isObjectNotFoundException`default implementation considers an
exception when its `SQLState` starts with 42.
### Why are the changes needed?
Before, if `isObjectNotFound` was not overridden (for example, in a custom
Dialect), then when any other error was thrown that was not ‘table does not
exist’, it would still be reported as a TableNotFound error, which is incorrect
### Does this PR introduce _any_ user-facing change?
Updated method in JDBCDialects.
### How was this patch tested?
In another PR #53541.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #53456 from SavicStefan/stefan-savic_data/stefan.
Authored-by: Stefan Savić <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit aad5b6e19c6eb9280ae7e1f04cd39b2f055aa3ce)
Signed-off-by: Wenchen Fan <[email protected]>
---
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
index ce4c347cad34..6b4e743ce989 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
@@ -772,7 +772,9 @@ abstract class JdbcDialect extends Serializable with
Logging {
}
@Since("4.1.0")
- def isObjectNotFoundException(e: SQLException): Boolean = true
+ def isObjectNotFoundException(e: SQLException): Boolean = {
+ Option(e.getSQLState).exists(_.startsWith("42"))
+ }
/**
* Gets a dialect exception, classifies it and wraps it by
`AnalysisException`.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]