rdblue commented on a change in pull request #25247: [SPARK-28319][SQL] 
Implement SHOW TABLES for Data Source V2 Tables
URL: https://github.com/apache/spark/pull/25247#discussion_r310404713
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceResolution.scala
 ##########
 @@ -163,6 +163,24 @@ case class DataSourceResolution(
     case DataSourceV2Relation(CatalogTableAsV2(catalogTable), _, _) =>
       UnresolvedCatalogRelation(catalogTable)
 
+    case ShowTablesStatement(None, pattern) =>
+      defaultCatalog match {
+        case Some(_) =>
+          throw new AnalysisException(
+            "v2 catalog doesn't support getCurrentDatabase yet, " +
+              "so the default database name cannot be deduced.")
+        case None =>
+          ShowTablesCommand(None, pattern)
+      }
+
+    case plan @ ShowTablesStatement(Some(namespace), pattern) =>
+      val CatalogObjectIdentifier(maybeCatalog, identifier) = namespace
 
 Review comment:
   I think we may need a different matcher. I noted below that this passes an 
identifier instead of `Array[String]`, but I also realized that the identifier 
here must have at least a table name. So `SHOW TABLES FROM catalog` would 
produce `CatalogObjectIdentifer(None, Identifer("catalog"))`. I don't think 
that's correct. We should probably add a `CatalogNamespace` extractor to handle 
this. Then you'd get an `Array[String]` from it and could base the plans on 
passing a real namespace.

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

Reply via email to