-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-20303][SQL] Rename createTempFunction to registerFunction #17615
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
Conversation
|
Test build #75725 has started for PR 17615 at commit |
| // } else { | ||
| // // This function is a Hive builtin function. | ||
| // ... | ||
| // } |
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.
LookupFunction already accepts FunctionIdentifier, but we are unable to do it using the above way because functionExists does not consider the difference among Hive built-in, Spark temporary and permanent functions. More following clean-ups are needed. Will try to do it.
| * This performs reflection to decide what type of [[Expression]] to return in the builder. | ||
| */ | ||
| def makeFunctionBuilder(name: String, functionClassName: String): FunctionBuilder = { | ||
| protected def makeFunctionBuilder(name: String, functionClassName: String): FunctionBuilder = { |
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.
registerFunction is the only caller of makeFunctionBuilder after this PR.
| // For a permanent, we will store the metadata into underlying external catalog. | ||
| // This function will be loaded into the FunctionRegistry when a query uses it. | ||
| // We do not load it into FunctionRegistry right now. | ||
| // TODO: should we also parse "IF NOT EXISTS"? |
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.
Should we support it? @cloud-fan @yhuai @rxin
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.
does hive support it?
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.
Nope. : )
Oracle has the OR REPLACE clause.
|
LGTM |
|
retest this please |
|
Test build #75735 has finished for PR 17615 at commit
|
|
Thanks! Merging to master. |
### What changes were proposed in this pull request? Session catalog API `createTempFunction` is being used by Hive build-in functions, persistent functions, and temporary functions. Thus, the name is confusing. This PR is to rename it by `registerFunction`. Also we can move construction of `FunctionBuilder` and `ExpressionInfo` into the new `registerFunction`, instead of duplicating the logics everywhere. In the next PRs, the remaining Function-related APIs also need cleanups. ### How was this patch tested? Existing test cases. Author: Xiao Li <[email protected]> Closes apache#17615 from gatorsmile/cleanupCreateTempFunction.
What changes were proposed in this pull request?
Session catalog API
createTempFunctionis being used by Hive build-in functions, persistent functions, and temporary functions. Thus, the name is confusing. This PR is to rename it byregisterFunction. Also we can move construction ofFunctionBuilderandExpressionInfointo the newregisterFunction, instead of duplicating the logics everywhere.In the next PRs, the remaining Function-related APIs also need cleanups.
How was this patch tested?
Existing test cases.