imback82 commented on a change in pull request #29198:
URL: https://github.com/apache/spark/pull/29198#discussion_r459204665



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -3650,12 +3652,24 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
       }
     }
 
-    val functionIdentifier = visitMultipartIdentifier(ctx.multipartIdentifier)
-    CreateFunctionStatement(
-      functionIdentifier,
+    val nameParts = visitMultipartIdentifier(ctx.multipartIdentifier)
+    val isTemp = ctx.TEMPORARY != null
+    val func: LogicalPlan = if (isTemp) {
+      import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
+      // temp func doesn't belong to any catalog and we shouldn't resolve 
catalog in the name.
+      if (nameParts.length > 2) {
+        throw new AnalysisException(s"Unsupported function name 
'${nameParts.quoted}'")
+      }
+      ResolvedFunc(nameParts.asIdentifier)

Review comment:
       This logic is moved from `ResolveSessionCatalog`, and I think we can 
resolve here directly.




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