huaxingao commented on a change in pull request #30473:
URL: https://github.com/apache/spark/pull/30473#discussion_r534522414
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala
##########
@@ -171,6 +175,130 @@ class JDBCTableCatalog extends TableCatalog with Logging {
}
}
+ override def namespaceExists(namespace: Array[String]): Boolean = namespace
match {
+ case Array(db) =>
+ withConnection { conn =>
+ val rs = conn.getMetaData.getSchemas(null, db)
Review comment:
DB2 jdbc driver implements this to return schemas from the current
catalog (the current database jdbc driver connects to). Not sure how other jdbc
drivers implement this. I tested with postgres jdbc driver, it also returns
schemas from the current catalog. In listTables
(https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala#L62),
we also assume ```getTables``` with `null` as catalog value returns tables
from the current catalog.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]