Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17848#discussion_r128657154
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala ---
@@ -130,460 +138,507 @@ class UDFRegistration private[sql]
(functionRegistry: FunctionRegistry) extends
val version = if (i == 0) "2.3.0" else "1.3.0"
val funcCall = if (i == 0) "() => func" else "func"
println(s"""
- |/**
- | * Register a user-defined function with ${i} arguments.
- | * @since $version
- | */
- |def register(name: String, f: UDF$i[$extTypeArgs], returnType:
DataType): Unit = {
- | val func = f$anyCast.call($anyParams)
- | def builder(e: Seq[Expression]) = if (e.length == $i) {
- | ScalaUDF($funcCall, returnType, e)
- | } else {
- | throw new AnalysisException("Invalid number of arguments for
function " + name +
- | ". Expected: $i; Found: " + e.length)
- | }
- | functionRegistry.createOrReplaceTempFunction(name, builder)
- |}""".stripMargin)
+ |/**
+ | * Registers a deterministic user-defined function with ${i}
arguments.
+ | * @since $version
+ | */
+ |def register(name: String, f: UDF$i[$extTypeArgs], returnType:
DataType): Unit = {
+ | register(name, f, returnType, deterministic = true)
+ |}
+ |
+ |/**
+ | * Registers a user-defined function with ${i} arguments.
+ | * @since 2.3.0
+ | */
+ |def register(name: String, f: UDF$i[$extTypeArgs], returnType:
DataType, deterministic: Boolean): Unit = {
--- End diff --
So far, the impl of `def udf(f: AnyRef, dataType: DataType)` does not
support Java UDF
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]