sunchao commented on a change in pull request #32082:
URL: https://github.com/apache/spark/pull/32082#discussion_r620896602



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1955,20 +1959,29 @@ class Analyzer(override val catalogManager: 
CatalogManager)
    * @see https://issues.apache.org/jira/browse/SPARK-19737
    */
   object LookupFunctions extends Rule[LogicalPlan] {
+    import CatalogV2Implicits._
     override def apply(plan: LogicalPlan): LogicalPlan = {
       val externalFunctionNameSet = new mutable.HashSet[FunctionIdentifier]()
       plan.resolveExpressions {
-        case f: UnresolvedFunction
-          if externalFunctionNameSet.contains(normalizeFuncName(f.name)) => f
-        case f: UnresolvedFunction if 
v1SessionCatalog.isRegisteredFunction(f.name) => f
-        case f: UnresolvedFunction if 
v1SessionCatalog.isPersistentFunction(f.name) =>
-          externalFunctionNameSet.add(normalizeFuncName(f.name))
+        case f @ UnresolvedFunction(NonSessionCatalogAndIdentifier(_, _), _, 
_, _, _) =>

Review comment:
       Good point. I've combined these clauses into one. Actually, I think it 
may be better to add the 
`v1SessionCatalog.isRegisteredFunction(FunctionIdentifier(name))` into 
`AsFunctionIdentifier`, so that we can just have this logic:
   ```
   case f @ UnresolvedFunction(AsFunctionIdentifier(ident), ...) =>
     // process V1 session catalog function
   
   case f @ UnresolvedFunction(nameParts, ...) =>
     // process V2 catalog function
   ```
   
   Let me know what you think.




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