cloud-fan commented on a change in pull request #34121:
URL: https://github.com/apache/spark/pull/34121#discussion_r717297303



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -451,31 +451,34 @@ class ResolveSessionCatalog(val catalogManager: 
CatalogManager)
       val funcIdentifier = identifier.asFunctionIdentifier
       DropFunctionCommand(funcIdentifier.database, funcIdentifier.funcName, 
ifExists, isTemp)
 
-    case CreateFunctionStatement(nameParts,
-      className, resources, isTemp, ignoreIfExists, replace) =>
-      if (isTemp) {
-        // temp func doesn't belong to any catalog and we shouldn't resolve 
catalog in the name.
-        val database = if (nameParts.length > 2) {
-          throw 
QueryCompilationErrors.unsupportedFunctionNameError(nameParts.quoted)
-        } else if (nameParts.length == 2) {
-          Some(nameParts.head)
-        } else {
-          None
-        }
-        CreateFunctionCommand(
-          database,
-          nameParts.last,
-          className,
-          resources,
-          isTemp,
-          ignoreIfExists,
-          replace)
+    case CreateTempFunction(nameParts, className, resources, ignoreIfExists, 
replace) =>
+      // temp func doesn't belong to any catalog and we shouldn't resolve 
catalog in the name.
+      val database = if (nameParts.length > 2) {
+        throw 
QueryCompilationErrors.unsupportedFunctionNameError(nameParts.quoted)
+      } else if (nameParts.length == 2) {
+        Some(nameParts.head)
       } else {
-        val FunctionIdentifier(function, database) =
-          parseSessionCatalogFunctionIdentifier(nameParts)
-        CreateFunctionCommand(database, function, className, resources, 
isTemp, ignoreIfExists,
-          replace)
+        None
       }
+      CreateFunctionCommand(
+        database,
+        nameParts.last,
+        className,
+        resources,
+        true,
+        ignoreIfExists,
+        replace)
+
+    case CreateFunction(ResolvedDBObjectName(catalog, name),
+        className, resources, ignoreIfExists, replace) if 
isSessionCatalog(catalog) =>
+      CreateFunctionCommand(
+        Some(catalog.name),

Review comment:
       this is catalog name, not database name




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