Interface BoundFunction
- All Superinterfaces:
Function
,Serializable
- All Known Subinterfaces:
AggregateFunction<S,
,R> ScalarFunction<R>
- Since:
- 3.2.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Returns the canonical name of this function, used to determine if functions are equivalent.DataType[]
Returns the requireddata types
of the input values to this function.default boolean
Returns whether this function result is deterministic.default boolean
Returns whether the values produced by this function may be null.Returns thedata type
of values produced by this function.
-
Method Details
-
inputTypes
DataType[] inputTypes()Returns the requireddata types
of the input values to this function.If the types returned differ from the types passed to
UnboundFunction.bind(StructType)
, Spark will cast input values to the required data types. This allows implementations to delegate input value casting to Spark.- Returns:
- an array of input value data types
-
resultType
DataType resultType()Returns thedata type
of values produced by this function.For example, a "plus" function may return
IntegerType
when it is bound to arguments that are alsoIntegerType
.- Returns:
- a data type for values produced by this function
-
isResultNullable
default boolean isResultNullable()Returns whether the values produced by this function may be null.For example, a "plus" function may return false when it is bound to arguments that are always non-null, but true when either argument may be null.
- Returns:
- true if values produced by this function may be null, false otherwise
-
isDeterministic
default boolean isDeterministic()Returns whether this function result is deterministic.By default, functions are assumed to be deterministic. Functions that are not deterministic should override this method so that Spark can ensure the function runs only once for a given input.
- Returns:
- true if this function is deterministic, false otherwise
-
canonicalName
Returns the canonical name of this function, used to determine if functions are equivalent.The canonical name is used to determine whether two functions are the same when loaded by different catalogs. For example, the same catalog implementation may be used for by two environments, "prod" and "test". Functions produced by the catalogs may be equivalent, but loaded using different names, like "test.func_name" and "prod.func_name".
Names returned by this function should be unique and unlikely to conflict with similar functions in other catalogs. For example, many catalogs may define a "bucket" function with a different implementation. Adding context, like "com.mycompany.bucket(string)", is recommended to avoid unintentional collisions.
- Returns:
- a canonical name for this function
-