public class UserDefinedFunction
extends java.lang.Object
implements scala.Product, scala.Serializable
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) true else false)
// Projects a column that adds a prediction column based on the score column.
df.select( predict(df("score")) )
| Modifier | Constructor and Description |
|---|---|
protected |
UserDefinedFunction(java.lang.Object f,
DataType dataType,
scala.collection.Seq<DataType> inputTypes) |
| Modifier and Type | Method and Description |
|---|---|
Column |
apply(scala.collection.Seq<Column> exprs) |
DataType |
dataType() |
java.lang.Object |
f() |
scala.collection.Seq<DataType> |
inputTypes() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait