dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] 
Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393918282
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ##########
 @@ -880,6 +880,26 @@ class SessionCatalog(
     }
   }
 
+  /**
+   * List all matching views in the specified database, including global/local 
temporary views.
+   */
+  def listViews(db: String, pattern: String): Seq[TableIdentifier] = {
+    val dbName = formatDatabaseName(db)
+    val dbViews = if (dbName != globalTempViewManager.database) {
+      requireDbExists(dbName)
+      externalCatalog.listViews(dbName, pattern).map { name =>
+        TableIdentifier(name, Some(dbName))
+      }
+    } else {
+      Nil
+    }
+    // Always get global/local temp views
 
 Review comment:
   Since this is also based on pattern, we don't get result 'Always'.
   `Always get` -> `Always try to get` or we can remove this comment.

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