panbingkun commented on code in PR #46969:
URL: https://github.com/apache/spark/pull/46969#discussion_r1637893601


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/DB2Dialect.scala:
##########
@@ -160,13 +161,17 @@ private case class DB2Dialect() extends JdbcDialect with 
SQLConfHelper {
       description: String): AnalysisException = {
     e match {
       case sqlException: SQLException =>
+        logSQLException(sqlException, errorClass, messageParameters, 
description)
         sqlException.getSQLState match {
           // https://www.ibm.com/docs/en/db2/11.5?topic=messages-sqlstate
           case "42893" =>
             throw NonEmptyNamespaceException(
               namespace = messageParameters.get("namespace").toArray,
               details = sqlException.getMessage,
               cause = Some(e))
+          case "42710" if errorClass == "FAILED_JDBC.RENAME_TABLE" =>

Review Comment:
   ref:
   ```
   errorCode: -601, sqlState: 42710, message: The name of the object to be 
created is identical to the existing name "DB2INST1.tbl1" of type "TABLE".. 
SQLCODE=-601, SQLSTATE=42710, DRIVER=4.33.31, errorClass: 
FAILED_JDBC.RENAME_TABLE, messageParameters: Map(url -> 
jdbc:db2://10.1.0.20:43213/foo:user=db2inst1;***;retrieveMessagesFromServerOnGetMessage=true;,
 oldName -> `tbl2`, newName -> `tbl1`),description: Failed table renaming from 
tbl2 to tbl1
   ```



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