Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/17848#discussion_r115253834
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala ---
@@ -144,11 +181,24 @@ class UDFRegistration private[sql] (functionRegistry:
FunctionRegistry) extends
val inputTypes = Try(ScalaReflection.schemaFor[A1].dataType ::
Nil).toOption
def builder(e: Seq[Expression]) = ScalaUDF(func, dataType, e,
inputTypes.getOrElse(Nil), Some(name))
functionRegistry.registerFunction(name, builder)
- UserDefinedFunction(func, dataType, inputTypes)
+ UserDefinedFunction(func, dataType, inputTypes, Some(name))
}
/**
- * Register a Scala closure of 2 arguments as user-defined function
(UDF).
+ * Registers a Scala closure of 1 arguments as user-defined function
(UDF).
+ * @tparam RT return type of UDF.
+ * @since 2.3.0
+ */
+ def register[RT: TypeTag, A1: TypeTag](name: String, func: Function1[A1,
RT], deterministic : Boolean, distinctLike: Boolean): UserDefinedFunction = {
--- End diff --
I basically think these parameters are useful for users though, do we
always need to set `deterministic` and `distinctLike` when registering UDFs?
ISTM this is a little annoying for users, so we'd better to use default
parameters for these parameters?
---
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]