urosstan-db commented on code in PR #53456:
URL: https://github.com/apache/spark/pull/53456#discussion_r2615039458
##########
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): Option[Boolean] = {
+ Option(e.getSQLState).map(_.startsWith("42"))
Review Comment:
Note for reviewers: we want to have some generic implementation here that
covers almost all SQL engines (42000 group usually means no access, no object
found or syntax error on most engines, but since we don't expect syntax errors
when table parameter is provided, we should be fine with this approach).
The most used callsite for `tableExists` now is in `createRelation` on write
path. It checks whether `tableExists`, and it table does not exist, it goes on
create table path. We should be fine even if we catch some other error than
object not found in `tableExists`, since `createTable` would probably fail as
well.
--
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]