public class UserDefinedFunction
extends 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 and Type | Method and Description |
---|---|
Column |
apply(scala.collection.Seq<Column> exprs) |
DataType |
dataType() |
Object |
f() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait