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


##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -191,21 +192,77 @@ class CatalogImpl(sparkSession: SparkSession) extends 
Catalog {
    */
   @throws[AnalysisException]("database does not exist")
   override def listFunctions(dbName: String): Dataset[Function] = {
-    requireDatabaseExists(dbName)
-    val functions = sessionCatalog.listFunctions(dbName).map { case 
(functIdent, _) =>
-      makeFunction(functIdent)
+    // `dbName` could be either a single database name (behavior in Spark 3.3 
and prior) or
+    // a qualified namespace with catalog name. We assume it's a single 
database name
+    // and check if we can find the dbName in sessionCatalog. If so we 
listFunctions under
+    // that database. Otherwise we try 3-part name parsing and locate the 
database.
+    if (sessionCatalog.databaseExists(dbName) || 
sessionCatalog.isGlobalTempViewDB(dbName)) {

Review Comment:
   we don't need to check global temp view db, as we are listing functions.



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