huaxingao commented on a change in pull request #30473:
URL: https://github.com/apache/spark/pull/30473#discussion_r532375082



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala
##########
@@ -170,6 +174,125 @@ class JDBCTableCatalog extends TableCatalog with Logging {
     }
   }
 
+  override def namespaceExists(namespace: Array[String]): Boolean = namespace 
match {
+    case Array(db) =>
+      listNamespaces.exists (_(0) == db)
+    case _ => false
+  }
+
+  override def listNamespaces(): Array[Array[String]] = {
+    withConnection { conn =>
+      val catalogs = conn.getMetaData.getCatalogs()

Review comment:
       Sorry for the late reply. I was OoO last week.
   
   Yes, it connects to the current database, which is specified in the 
connection url.
   For example: 
   ```postgres``` in 
```jdbc:postgresql://127.0.0.1:5432/postgres;user=testUser;password=testPass```
    or ```testdb0``` in 
```jdbc:h2:mem:testdb0;user=testUser;password=testPass```
   




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

Reply via email to