Interface SpecializedFunction
-
- All Superinterfaces:
FunctionDefinition
- All Known Implementing Classes:
BuiltInFunctionDefinition
@PublicEvolving public interface SpecializedFunction extends FunctionDefinition
AFunctionDefinitionthat can provide a runtime implementation (i.e. the function's body) that is specialized for the given call and session.The planner tries to defer the specialization until shortly before code generation, where the information given by a
FunctionDefinitionis not enough anymore and a subclass ofUserDefinedFunctionis required for runtime.This interface is useful when the runtime code should know about information that is only available after planning (e.g. local session time zone or precision/scale of decimal return type).
A
UserDefinedFunctionthat is registered in the API is implicitly specialized but can also implement this interface to reconfigure itself before runtime.Note: This interface is a rather low level kind of function but useful for advanced users.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSpecializedFunction.ExpressionEvaluatorSerializable factory that can be passed into aUserDefinedFunctionfor evaluating previously defined expression during runtime.static interfaceSpecializedFunction.ExpressionEvaluatorFactoryHelper interface for creatingSpecializedFunction.ExpressionEvaluators.static interfaceSpecializedFunction.SpecializedContextProvides call and session information for the specialized function.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description UserDefinedFunctionspecialize(SpecializedFunction.SpecializedContext context)Provides a runtime implementation that is specialized for the given call and session.-
Methods inherited from interface org.apache.flink.table.functions.FunctionDefinition
getKind, getRequirements, getTypeInference, isDeterministic, supportsConstantFolding
-
-
-
-
Method Detail
-
specialize
UserDefinedFunction specialize(SpecializedFunction.SpecializedContext context)
Provides a runtime implementation that is specialized for the given call and session.The method must return an instance of
UserDefinedFunctionor throw aTableExceptionif the given call is not supported. The returned instance must have the sameFunctionDefinitionsemantics but can have a differentFunctionDefinition.getTypeInference(DataTypeFactory)implementation.
-
-