-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-6379][SQL] Support a functon to call user-defined functions registered in SQLContext #5061
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
|
Can't we make this explicit by using "callUDF"? |
|
You mean df.select( |
|
I meant something like df.select($"id", callUDF("simpleUDF", $"value")) |
|
Ok, I'll try to refine my codes. |
|
@rxin fixed, and plz check 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.
This probably belongs in functions.scala with the other callUDF methods. Also, please explicitly specify return types for public methods.
|
Once you have updated, can you also update the PR description, as this becomes the commit message. Thanks! |
bb07c54 to
5929b9f
Compare
|
The description updated and the patch fixed. |
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.
This probably belongs in functions.scala with the other callUDF methods.
This is still defined in the wrong file.
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.
Oh, misunderstood.
I'll move the function into functions.scala.
|
Fixed, and plz re-check it. |
5929b9f to
f858aff
Compare
|
ok to test |
|
Test build #30095 has finished for PR 5061 at commit
|
|
Thanks! Merged to master. |
This is useful for using pre-defined UDFs in SQLContext;
val df = Seq(("id1", 1), ("id2", 4), ("id3", 5)).toDF("id", "value")$"id", sqlctx.callUdf("simpleUdf", $ "value"))
val sqlctx = df.sqlContext
sqlctx.udf.register("simpleUdf", (v: Int) => v * v)
df.select(