@Evolving public interface BoundFunction extends Function
Modifier and Type | Method and Description |
---|---|
default String |
canonicalName()
Returns the canonical name of this function, used to determine if functions are equivalent.
|
DataType[] |
inputTypes()
Returns the required
data types of the input values to this function. |
default boolean |
isDeterministic()
Returns whether this function result is deterministic.
|
default boolean |
isResultNullable()
Returns whether the values produced by this function may be null.
|
DataType |
resultType()
Returns the
data type of values produced by this function. |
DataType[] inputTypes()
data 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.
DataType resultType()
data type
of values produced by this function.
For example, a "plus" function may return IntegerType
when it is bound to arguments
that are also IntegerType
.
default boolean isResultNullable()
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.
default boolean isDeterministic()
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.
default String canonicalName()
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.