imback82 commented on a change in pull request #25601: [SPARK-28856][SQL] 
Implement SHOW DATABASES for Data Source V2 Tables
URL: https://github.com/apache/spark/pull/25601#discussion_r320852256
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceResolution.scala
 ##########
 @@ -178,6 +178,27 @@ case class DataSourceResolution(
       val aliased = delete.tableAlias.map(SubqueryAlias(_, 
relation)).getOrElse(relation)
       DeleteFromTable(aliased, delete.condition)
 
+    case ShowNamespacesStatement(None, pattern) =>
+      defaultCatalog match {
+        case Some(catalog: SupportsNamespaces) =>
+          ShowNamespaces(catalog, None, pattern)
+        case Some(_) =>
+          throw new AnalysisException(
+            "The default v2 catalog doesn't support showing namespaces.")
+        case None =>
+          throw new AnalysisException("No default v2 catalog is set.")
+      }
+
+    case ShowNamespacesStatement(Some(namespace), pattern) =>
+      val CatalogNamespace(maybeCatalog, ns) = namespace
+      maybeCatalog match {
+        case Some(catalog: SupportsNamespaces) =>
+          ShowNamespaces(catalog, Some(ns), pattern)
 
 Review comment:
   I put this logic in `ShowNamespacesExec`. If we move here, there is an 
implicit contract that if `namespace` is `Some`, it should be `nonEmpty` 
(meaning I need to add a `require` check to make it explicit in 
`ShowNamespaceExec`).

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to