linhongliu-db commented on a change in pull request #30662:
URL: https://github.com/apache/spark/pull/30662#discussion_r539085846



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
##########
@@ -1488,12 +1488,28 @@ class SessionCatalog(
     // We probably shouldn't use a single FunctionRegistry to register all 
three kinds of functions
     // (built-in, temp, and external).
     if (name.database.isEmpty && functionRegistry.functionExists(name)) {
-      // This function has been already loaded into the function registry.
-      return functionRegistry.lookupFunction(name, children)
+      val isResolvingView = AnalysisContext.get.catalogAndNamespace.nonEmpty
+      // We lookup function without database in two cases:
+      // 1. the function is not a temporary function

Review comment:
       there are also external functions, in `isTemporaryFunction`:
   ```
       name.database.isEmpty &&
         functionRegistry.functionExists(name) &&
         !FunctionRegistry.builtin.functionExists(name) &&
         !hiveFunctions.contains(name.funcName.toLowerCase(Locale.ROOT))
   ```




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



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

Reply via email to