case classUserDefinedFunction(f: AnyRef, dataType: DataType, inputTypes: Option[Seq[DataType]]) extends Product with Serializable
A user-defined function. To create one, use the udf functions in functions.
As an example:
// Defined a UDF that returns true or false based on some numeric score.val predict = udf((score: Double) =>if (score > 0.5) trueelsefalse)
// Projects a column that adds a prediction column based on the score column.
df.select( predict(df("score")) )
The user-defined functions must be deterministic. Due to optimization,
duplicate invocations may be eliminated or the function may even be invoked more times than
it is present in the query.
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
A user-defined function. To create one, use the
udf
functions infunctions
.As an example:
1.3.0
The user-defined functions must be deterministic. Due to optimization, duplicate invocations may be eliminated or the function may even be invoked more times than it is present in the query.