public class UserDefinedFunction
extends Object
implements scala.Product, scala.Serializable
udf
functions in functions
.
Note that 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.
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) |
abstract static boolean |
canEqual(Object that) |
DataType |
dataType() |
abstract static boolean |
equals(Object that) |
Object |
f() |
scala.Option<scala.collection.Seq<DataType>> |
inputTypes() |
abstract static int |
productArity() |
abstract static Object |
productElement(int n) |
static scala.collection.Iterator<Object> |
productIterator() |
static String |
productPrefix() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public abstract static boolean canEqual(Object that)
public abstract static boolean equals(Object that)
public abstract static Object productElement(int n)
public abstract static int productArity()
public static scala.collection.Iterator<Object> productIterator()
public static String productPrefix()
public Object f()
public DataType dataType()
public scala.Option<scala.collection.Seq<DataType>> inputTypes()