Class BuiltInFunctionDefinition
- java.lang.Object
-
- org.apache.flink.table.functions.BuiltInFunctionDefinition
-
- All Implemented Interfaces:
FunctionDefinition,SpecializedFunction
@Internal public final class BuiltInFunctionDefinition extends Object implements SpecializedFunction
Definition of a built-in function. It enables unique identification across different modules by reference equality.Compared to regular
FunctionDefinition, built-in functions have a default name. This default name is used to look up the function in a catalog during resolution. However, note that every built-in function is actually fully qualified by a name and a version. Internal functions are required to have a name that includes the version (e.g.$REPLICATE_ROWS$1). The most recent version of a regular function is picked during a lookup if a call does not reference an internal function.Equality is defined by reference equality.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBuiltInFunctionDefinition.BuilderBuilder for fluent definition of built-in functions.-
Nested classes/interfaces inherited from interface org.apache.flink.table.functions.SpecializedFunction
SpecializedFunction.ExpressionEvaluator, SpecializedFunction.ExpressionEvaluatorFactory, SpecializedFunction.SpecializedContext
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_VERSION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlCallSyntaxgetCallSyntax()FunctionKindgetKind()Returns the kind of function this definition describes.StringgetName()StringgetQualifiedName()Optional<String>getRuntimeClass()StringgetSqlName()TypeInferencegetTypeInference(DataTypeFactory typeFactory)Returns the logic for performing type inference of a call to this function definition.Optional<Integer>getVersion()booleanhasRuntimeImplementation()booleanisDeterministic()Returns information about the determinism of the function's results.booleanisInternal()static BuiltInFunctionDefinition.BuildernewBuilder()Builder for configuring and creating instances ofBuiltInFunctionDefinition.static StringqualifyFunctionName(String name, int version)UserDefinedFunctionspecialize(SpecializedFunction.SpecializedContext context)Provides a runtime implementation that is specialized for the given call and session.StringtoString()static voidvalidateFunction(String name, Integer version, boolean isInternal)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.functions.FunctionDefinition
getRequirements, supportsConstantFolding
-
-
-
-
Field Detail
-
DEFAULT_VERSION
public static final int DEFAULT_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
newBuilder
public static BuiltInFunctionDefinition.Builder newBuilder()
Builder for configuring and creating instances ofBuiltInFunctionDefinition.
-
getName
public String getName()
-
getSqlName
public String getSqlName()
-
hasRuntimeImplementation
public boolean hasRuntimeImplementation()
-
isInternal
public boolean isInternal()
-
getQualifiedName
public String getQualifiedName()
-
specialize
public UserDefinedFunction specialize(SpecializedFunction.SpecializedContext context)
Description copied from interface:SpecializedFunctionProvides 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.- Specified by:
specializein interfaceSpecializedFunction
-
getKind
public FunctionKind getKind()
Description copied from interface:FunctionDefinitionReturns the kind of function this definition describes.- Specified by:
getKindin interfaceFunctionDefinition
-
getTypeInference
public TypeInference getTypeInference(DataTypeFactory typeFactory)
Description copied from interface:FunctionDefinitionReturns the logic for performing type inference of a call to this function definition.The type inference process is responsible for inferring unknown types of input arguments, validating input arguments, and producing result types. The type inference process happens independent of a function body. The output of the type inference is used to search for a corresponding runtime implementation.
Instances of type inference can be created by using
TypeInference.newBuilder().See
BuiltInFunctionDefinitionsfor concrete usage examples.- Specified by:
getTypeInferencein interfaceFunctionDefinition
-
getCallSyntax
public SqlCallSyntax getCallSyntax()
-
isDeterministic
public boolean isDeterministic()
Description copied from interface:FunctionDefinitionReturns information about the determinism of the function's results.It returns
trueif and only if a call to this function is guaranteed to always return the same result given the same parameters.trueis assumed by default. If the function is not purely functional likerandom(), date(), now(), ...this method must returnfalse.Furthermore, return
falseif the planner should always execute this function on the cluster side. In other words: the planner should not perform constant expression reduction during planning for constant calls to this function.- Specified by:
isDeterministicin interfaceFunctionDefinition
-
validateFunction
public static void validateFunction(String name, @Nullable Integer version, boolean isInternal)
-
-