sunchao commented on a change in pull request #32082:
URL: https://github.com/apache/spark/pull/32082#discussion_r621530817
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1958,18 +1961,23 @@ class Analyzer(override val catalogManager:
CatalogManager)
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))
- f
- case f: UnresolvedFunction =>
- withPosition(f) {
- throw new NoSuchFunctionException(
- f.name.database.getOrElse(v1SessionCatalog.getCurrentDatabase),
- f.name.funcName)
+ case f @ UnresolvedFunction(AsFunctionIdentifier(ident), _, _, _, _) =>
+ if (externalFunctionNameSet.contains(normalizeFuncName(ident)) ||
+ v1SessionCatalog.isRegisteredFunction(ident)) {
+ f
+ } else if (v1SessionCatalog.isPersistentFunction(ident)) {
+ externalFunctionNameSet.add(normalizeFuncName(ident))
+ f
+ } else {
+ withPosition(f) {
+ throw new NoSuchFunctionException(
+ ident.database.getOrElse(v1SessionCatalog.getCurrentDatabase),
+ ident.funcName)
+ }
}
+ case f: UnresolvedFunction =>
Review comment:
Oops didn't realize that. Removed for now but we may add back in future
when we have V2 API for checking function existence.
--
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]