You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/25 08:03:38 UTC
[GitHub] [spark] allisonwang-db commented on a change in pull request #35304: [SPARK-38003][SQL] LookupFunctions rule should only look up functions from the scalar function registry
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org