Skip to content

Conversation

@gatorsmile
Copy link
Member

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.

@SparkQA
Copy link

SparkQA commented Apr 12, 2017

Test build #75725 has started for PR 17615 at commit e876af1.

// } else {
// // This function is a Hive builtin function.
// ...
// }
Copy link
Member Author

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 = {
Copy link
Member Author

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"?
Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does hive support it?

Copy link
Member Author

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.

@cloud-fan
Copy link
Contributor

LGTM

@gatorsmile
Copy link
Member Author

retest this please

@SparkQA
Copy link

SparkQA commented Apr 12, 2017

Test build #75735 has finished for PR 17615 at commit e876af1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member Author

Thanks! Merging to master.

@asfgit asfgit closed this in 504e62e Apr 12, 2017
peter-toth pushed a commit to peter-toth/spark that referenced this pull request Oct 6, 2018
### 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants