This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new aad5b6e19c6e [SPARK-54800] Changed default implementation for 
isObjectNotFoundException
aad5b6e19c6e is described below

commit aad5b6e19c6eb9280ae7e1f04cd39b2f055aa3ce
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]>
---
 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 875bfeb011bb..e89354ce708c 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
@@ -783,7 +783,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]

Reply via email to