Package org.apache.spark.sql.expressions
Class UserDefinedFunction
Object
org.apache.spark.sql.expressions.UserDefinedFunction
- All Implemented Interfaces:
- org.apache.spark.sql.internal.UserDefinedFunctionLike
public abstract class UserDefinedFunction
extends Object
implements org.apache.spark.sql.internal.UserDefinedFunctionLike
A user-defined function. To create one, use the 
udf functions in functions.
 As an example:
   // Define a UDF that returns true or false based on some numeric score.
   val predict = udf((score: Double) => score > 0.5)
   // Projects a column that adds a prediction column based on the score column.
   df.select( predict(df("score")) )
 - Since:
- 1.3.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns an expression that invokes the UDF, using the given arguments.Returns an expression that invokes the UDF, using the given arguments.abstract UserDefinedFunctionUpdates UserDefinedFunction to nondeterministic.abstract UserDefinedFunctionUpdates UserDefinedFunction to non-nullable.abstract booleanReturns true iff the UDF is deterministic, i.e.abstract booleannullable()Returns true when the UDF can return a nullable value.abstract UserDefinedFunctionUpdates UserDefinedFunction with a given name.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.sql.internal.UserDefinedFunctionLikename
- 
Constructor Details- 
UserDefinedFunctionpublic UserDefinedFunction()
 
- 
- 
Method Details- 
applyReturns an expression that invokes the UDF, using the given arguments.- Parameters:
- exprs- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
applyReturns an expression that invokes the UDF, using the given arguments.- Parameters:
- exprs- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
asNonNullableUpdates UserDefinedFunction to non-nullable.- Returns:
- (undocumented)
- Since:
- 2.3.0
 
- 
asNondeterministicUpdates UserDefinedFunction to nondeterministic.- Returns:
- (undocumented)
- Since:
- 2.3.0
 
- 
deterministicpublic abstract boolean deterministic()Returns true iff the UDF is deterministic, i.e. the UDF produces the same output given the same input.- Returns:
- (undocumented)
- Since:
- 2.3.0
 
- 
nullablepublic abstract boolean nullable()Returns true when the UDF can return a nullable value.- Returns:
- (undocumented)
- Since:
- 2.3.0
 
- 
withNameUpdates UserDefinedFunction with a given name.- Parameters:
- name- (undocumented)
- Returns:
- (undocumented)
- Since:
- 2.3.0
 
 
-