Uh oh!
There was an error while loading. Please reload this page.
[SPARK-22945][SQL] add java UDF APIs in the functions object - #20141
Closed
cloud-fan wants to merge 2 commits into
Closed
[SPARK-22945][SQL] add java UDF APIs in the functions object#20141cloud-fan wants to merge 2 commits into
cloud-fan wants to merge 2 commits into
Conversation
cloud-fan
commented
Jan 3, 2018
ContributorAuthor
cloud-fan
commented
Jan 3, 2018
| val udf = UserDefinedFunction(func, dataType, inputTypes).withName(name) | ||
| if (nullable) udf else udf.asNonNullable() | ||
| }""") | ||
| |/** |
ContributorAuthor
There was a problem hiding this comment.
just code style change, to use the multiline string format.
cloud-fan
commented
Jan 3, 2018
| * | ||
| * @since 1.3.0 | ||
| */ | ||
| @scala.annotation.varargs |
ContributorAuthor
There was a problem hiding this comment.
to make it java friendly, or shall we create a new method for java?
cloud-fan
commented
Jan 3, 2018
| * function (UDF). The data types are automatically inferred based on the function's | ||
| * signature. To change a UDF to nondeterministic, call the API | ||
| * `UserDefinedFunction.asNondeterministic()`. | ||
| * Defines a Scala closure of 0 arguments as user-defined function (UDF). |
ContributorAuthor
There was a problem hiding this comment.
to make the document consistent with UDFRegistration.register
SparkQA
commented
Jan 3, 2018
Test build #85629 has finished for PR 20141 at commit
|
| /** | ||
| * Defines a Java UDF1 instance as user-defined function (UDF). | ||
| * The caller must specify the output data type, and there is no automatic input type coercion. | ||
| * By default the returned UDF is deterministic, to change it to nondeterministic, call the |
gatorsmile
commented
Jan 4, 2018
Member
LGTM |
SparkQA
commented
Jan 4, 2018
Test build #85658 has finished for PR 20141 at commit
|
asfgit pushed a commit
that referenced
this pull request
Jan 4, 2018
## What changes were proposed in this pull request?
Currently Scala users can use UDF like
```
val foo = udf((i: Int) => Math.random() + i).asNondeterministic
df.select(foo('a))
```
Python users can also do it with similar APIs. However Java users can't do it, we should add Java UDF APIs in the functions object.
## How was this patch tested?
new tests
Author: Wenchen Fan <wenchen@databricks.com>
Closes#20141 from cloud-fan/udf.
(cherry picked from commit d5861ab)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>cloud-fan
commented
Jan 4, 2018
ContributorAuthor
thanks, merging to master/2.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently Scala users can use UDF like
Python users can also do it with similar APIs. However Java users can't do it, we should add Java UDF APIs in the functions object.
How was this patch tested?
new tests