-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23486]cache the function name from the external catalog for lookupFunctions #20795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5c8648c
caf6b6d
b8871e2
14c62e4
5c6687c
e030bd0
6358b92
74b01a5
27246fb
8dceda9
0db2826
26f2f54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,8 @@ | |
|
|
||
| package org.apache.spark.sql.catalyst.analysis | ||
|
|
||
| import java.util.Locale | ||
|
|
||
| import scala.collection.mutable | ||
| import scala.collection.mutable.ArrayBuffer | ||
| import scala.util.Random | ||
|
|
@@ -1212,17 +1214,21 @@ class Analyzer( | |
| object LookupFunctions extends Rule[LogicalPlan] { | ||
| override def apply(plan: LogicalPlan): LogicalPlan = { | ||
| val catalogFunctionNameSet = new mutable.HashSet[FunctionIdentifier]() | ||
| plan.transformAllExpressions { | ||
| case f: UnresolvedFunction if catalogFunctionNameSet.contains(f.name) => f | ||
| case f: UnresolvedFunction if catalog.functionExists(f.name) => | ||
| catalogFunctionNameSet.add(f.name) | ||
| f | ||
| case f: UnresolvedFunction => | ||
| withPosition(f) { | ||
| throw new NoSuchFunctionException(f.name.database.getOrElse("default"), | ||
| f.name.funcName) | ||
| } | ||
| } | ||
| plan.transformAllExpressions { | ||
| case f: UnresolvedFunction if catalogFunctionNameSet.contains(f.name) => f | ||
| case f: UnresolvedFunction if catalog.functionExists(f.name) => | ||
| catalogFunctionNameSet.add(normalizeFuncName(f.name)) | ||
| f | ||
| case f: UnresolvedFunction => | ||
| withPosition(f) { | ||
| throw new NoSuchFunctionException(f.name.database.getOrElse("default"), | ||
| f.name.funcName) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private def normalizeFuncName(name: FunctionIdentifier): FunctionIdentifier = { | ||
| FunctionIdentifier(name.funcName.toLowerCase(Locale.ROOT), name.database) | ||
|
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think this should be current database instead of default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viirya Yeah..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viirya @dilipbiswal @gatorsmile @liancheng ok, I will change this.