cloud-fan commented on code in PR #37588:
URL: https://github.com/apache/spark/pull/37588#discussion_r1374599990


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala:
##########
@@ -33,17 +41,36 @@ case class ShowTablesExec(
     output: Seq[Attribute],
     catalog: TableCatalog,
     namespace: Seq[String],
-    pattern: Option[String]) extends V2CommandExec with LeafExecNode {
+    pattern: Option[String],
+    isExtended: Boolean = false,
+    partitionSpec: Option[ResolvedPartitionSpec] = None) extends V2CommandExec 
with LeafExecNode {
   override protected def run(): Seq[InternalRow] = {
     val rows = new ArrayBuffer[InternalRow]()
 
-    val tables = catalog.listTables(namespace.toArray)
-    tables.map { table =>
-      if (pattern.map(StringUtils.filterPattern(Seq(table.name()), 
_).nonEmpty).getOrElse(true)) {
-        rows += toCatalystRow(table.namespace().quoted, table.name(), 
isTempView(table))
+    if (partitionSpec.isEmpty) {
+      // Show the information of tables.
+      val identifiers = catalog.listTables(namespace.toArray)
+      identifiers.map { identifier =>
+        if (pattern.forall(StringUtils.filterPattern(Seq(identifier.name()), 
_).nonEmpty)) {
+          val isTemp = isTempView(identifier)

Review Comment:
   this looks wrong to me. According to the classdoc of 
`TableCatalog.listTables`, it should not return views.
   
   Since temp views are managed fully by Spark, we can just invoke internal 
Spark APIs to list temp views, and then call `TableCatalog.listTables`, and 
finally combine the results.



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

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to