allisonwang-db commented on a change in pull request #35304:
URL: https://github.com/apache/spark/pull/35304#discussion_r791441801
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2006,21 +2006,33 @@ class Analyzer(override val catalogManager:
CatalogManager)
override def apply(plan: LogicalPlan): LogicalPlan = {
val externalFunctionNameSet = new mutable.HashSet[Seq[String]]()
-
plan.resolveExpressionsWithPruning(_.containsAnyPattern(UNRESOLVED_FUNCTION)) {
- case f @ UnresolvedFunction(nameParts, _, _, _, _) =>
- if
(ResolveFunctions.lookupBuiltinOrTempFunction(nameParts).isDefined) {
+ def lookupFunction[T <: TreeNode[_]](
+ f: T,
+ nameParts: Seq[String],
+ lookupBuiltinOrTempFunc: Seq[String] => Option[ExpressionInfo]): T =
{
+ if (lookupBuiltinOrTempFunc(nameParts).isDefined) {
+ f
+ } else {
+ val CatalogAndIdentifier(catalog, ident) =
expandIdentifier(nameParts)
+ val fullName = normalizeFuncName(catalog.name +: ident.namespace :+
ident.name)
+ if (externalFunctionNameSet.contains(fullName)) {
+ f
+ } else if (catalog.asFunctionCatalog.functionExists(ident)) {
Review comment:
Let me update this PR to only fix the bug in looking up scalar
functions. Also, I discovered that the current error message for table
functions is more user-friendly:
```
could not resolve `dummy` to a table-valued function
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]