@PublicEvolving public interface SpecializedFunction extends FunctionDefinition
FunctionDefinition that 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 FunctionDefinition is not enough anymore and a subclass of UserDefinedFunction is 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 UserDefinedFunction that 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.
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
SpecializedFunction.SpecializedContext
Provides call and session information for the specialized function.
|
| 限定符和类型 | 方法和说明 |
|---|---|
UserDefinedFunction |
specialize(SpecializedFunction.SpecializedContext context)
Provides a runtime implementation that is specialized for the given call and session.
|
getKind, getRequirements, getTypeInference, isDeterministicUserDefinedFunction specialize(SpecializedFunction.SpecializedContext context)
The method must return an instance of UserDefinedFunction or throw a TableException if the given call is not supported. The returned instance must have the same
FunctionDefinition semantics but can have a different FunctionDefinition.getTypeInference(DataTypeFactory) implementation.
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.