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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala:
##########
@@ -1090,6 +1090,28 @@ class SessionCatalog(
     dbViews ++ listLocalTempViews(pattern)
   }
 
+  /**
+   * List all matching temp views in the specified database, including 
global/local temporary views.
+   */
+  def listTempViews(db: String, pattern: String): Seq[CatalogTable] = {
+    val dbName = format(db)
+    val globalTempViews = if (dbName == globalTempViewManager.database) {
+      globalTempViewManager.listViewNames(pattern).map { viewName =>
+        globalTempViewManager.get(viewName).map(_.tableMeta).getOrElse(
+          throw new NoSuchTableException(globalTempViewManager.database, 
viewName))

Review Comment:
   It's weird to throw this error during listing views. Shall we use `flatMap` 
and just skip the temp views that were deleted immediately after 
`globalTempViewManager.listViewNames`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to