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 class
BuiltInFunctionDefinition.Builder
Builder 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 int
DEFAULT_VERSION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlCallSyntax
getCallSyntax()
FunctionKind
getKind()
Returns the kind of function this definition describes.String
getName()
String
getQualifiedName()
Optional<String>
getRuntimeClass()
String
getSqlName()
TypeInference
getTypeInference(DataTypeFactory typeFactory)
Returns the logic for performing type inference of a call to this function definition.Optional<Integer>
getVersion()
boolean
hasRuntimeImplementation()
boolean
isDeterministic()
Returns information about the determinism of the function's results.boolean
isInternal()
static BuiltInFunctionDefinition.Builder
newBuilder()
Builder for configuring and creating instances ofBuiltInFunctionDefinition
.static String
qualifyFunctionName(String name, int version)
UserDefinedFunction
specialize(SpecializedFunction.SpecializedContext context)
Provides a runtime implementation that is specialized for the given call and session.String
toString()
static void
validateFunction(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:SpecializedFunction
Provides a runtime implementation that is specialized for the given call and session.The method must return an instance of
UserDefinedFunction
or throw aTableException
if the given call is not supported. The returned instance must have the sameFunctionDefinition
semantics but can have a differentFunctionDefinition.getTypeInference(DataTypeFactory)
implementation.- Specified by:
specialize
in interfaceSpecializedFunction
-
getKind
public FunctionKind getKind()
Description copied from interface:FunctionDefinition
Returns the kind of function this definition describes.- Specified by:
getKind
in interfaceFunctionDefinition
-
getTypeInference
public TypeInference getTypeInference(DataTypeFactory typeFactory)
Description copied from interface:FunctionDefinition
Returns 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
BuiltInFunctionDefinitions
for concrete usage examples.- Specified by:
getTypeInference
in interfaceFunctionDefinition
-
getCallSyntax
public SqlCallSyntax getCallSyntax()
-
isDeterministic
public boolean isDeterministic()
Description copied from interface:FunctionDefinition
Returns information about the determinism of the function's results.It returns
true
if and only if a call to this function is guaranteed to always return the same result given the same parameters.true
is assumed by default. If the function is not purely functional likerandom(), date(), now(), ...
this method must returnfalse
.Furthermore, return
false
if 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:
isDeterministic
in interfaceFunctionDefinition
-
validateFunction
public static void validateFunction(String name, @Nullable Integer version, boolean isInternal)
-
-