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_r321025626
##########
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)
+ case _ =>
+ throw new AnalysisException(
Review comment:
Using `asNamespaceCatalog` simplifies the matching. Thanks.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]