urosstan-db commented on code in PR #59148:
URL: https://github.com/apache/spark/pull/59148#discussion_r4146378561


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/DB2Dialect.scala:
##########
@@ -124,8 +124,10 @@ private case class DB2Dialect() extends JdbcDialect with 
SQLConfHelper with NoLe
   override def isCascadingTruncateTable(): Option[Boolean] = Some(false)
 
   // See 
https://www.ibm.com/docs/en/db2-for-zos/12.0.0?topic=codes-sqlstate-values-common-error
+  // 42601 is DB2's syntax error. Other class 42 states are not syntax errors, 
e.g. 42704
+  // (undefined object) and 42501 (insufficient privilege).
   override def isSyntaxErrorBestEffort(exception: SQLException): Boolean = {
-    Option(exception.getSQLState).exists(_.startsWith("42"))
+    "42601".equals(exception.getSQLState)

Review Comment:
   Are you sure we listed all things:
   
   <img width="1850" height="984" alt="Image" 
src="https://github.com/user-attachments/assets/d1a59479-ecfe-426e-a4f3-c91b68f941f7";
 />
   42602, 42603 and 42604 seems like strong candidates as well, check this list:
   
https://www.ibm.com/docs/en/db2-for-zos/12.0.0?topic=codes-sqlstate-values-common-error#db2z_sqlstatevalues__classcode42



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