Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/20795
  
    And I don't think it need to split into builtin and external function exist 
check in this case. Just following code works fine:
    ```
      object LookupFunctions extends Rule[LogicalPlan] {
        override def apply(plan: LogicalPlan): LogicalPlan = {
          val cachedNameSet = new mutable.HashSet[FunctionIdentifier]()
          plan.transformAllExpressions {
            case f: UnresolvedFunction
              if cachedNameSet.contains(normalizeFuncName(f.name)) => f
            case f: UnresolvedFunction if catalog.functionExists(f.name) =>
              cachedNameSet.add(normalizeFuncName(f.name))
              f
            case f: UnresolvedFunction =>
              withPosition(f) {
                throw new 
NoSuchFunctionException(f.name.database.getOrElse(catalog.getCurrentDatabase),
                  f.name.funcName)
              }
          }
        }
    
        private def normalizeFuncName(name: FunctionIdentifier): 
FunctionIdentifier = ...
      }
    ```
    Isn't it ?


---

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

Reply via email to