@Internal public final class UserDefinedFunctionHelper extends Object
UserDefinedFunction. The purpose of this class is
to keep the user-facing APIs clean and offer methods/constants from here.
It contains methods for instantiating, validating and extracting types during function registration in a catalog.
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
AGGREGATE_ACCUMULATE |
static String |
AGGREGATE_MERGE |
static String |
AGGREGATE_RETRACT |
static String |
ASYNC_TABLE_EVAL |
static String |
SCALAR_EVAL |
static String |
TABLE_AGGREGATE_ACCUMULATE |
static String |
TABLE_AGGREGATE_EMIT |
static String |
TABLE_AGGREGATE_EMIT_RETRACT |
static String |
TABLE_AGGREGATE_MERGE |
static String |
TABLE_AGGREGATE_RETRACT |
static String |
TABLE_EVAL |
| 限定符和类型 | 方法和说明 |
|---|---|
static UserDefinedFunction |
createSpecializedFunction(String functionName,
FunctionDefinition definition,
CallContext callContext,
ClassLoader builtInClassLoader,
org.apache.flink.configuration.ReadableConfig configuration)
Creates the runtime implementation of a
FunctionDefinition as an instance of UserDefinedFunction. |
static String |
generateInlineFunctionName(UserDefinedFunction function)
Name for anonymous, inline functions.
|
static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<ACC> |
getAccumulatorTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction)
Tries to infer the TypeInformation of an AggregateFunction's accumulator type.
|
static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<ACC> |
getAccumulatorTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction,
org.apache.flink.api.common.typeinfo.TypeInformation<ACC> scalaType)
Tries to infer the TypeInformation of an AggregateFunction's accumulator type.
|
static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<T> |
getReturnTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction)
Tries to infer the TypeInformation of an AggregateFunction's accumulator type.
|
static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<T> |
getReturnTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction,
org.apache.flink.api.common.typeinfo.TypeInformation<T> scalaType)
Tries to infer the TypeInformation of an AggregateFunction's accumulator type.
|
static <T> org.apache.flink.api.common.typeinfo.TypeInformation<T> |
getReturnTypeOfTableFunction(TableFunction<T> tableFunction)
Tries to infer the TypeInformation of an AggregateFunction's accumulator type.
|
static <T> org.apache.flink.api.common.typeinfo.TypeInformation<T> |
getReturnTypeOfTableFunction(TableFunction<T> tableFunction,
org.apache.flink.api.common.typeinfo.TypeInformation<T> scalaType)
Tries to infer the TypeInformation of an AggregateFunction's accumulator type.
|
static UserDefinedFunction |
instantiateFunction(Class<?> functionClass)
Instantiates a
UserDefinedFunction assuming a JVM function with default constructor. |
static UserDefinedFunction |
instantiateFunction(ClassLoader classLoader,
org.apache.flink.configuration.ReadableConfig config,
String name,
CatalogFunction catalogFunction)
Instantiates a
UserDefinedFunction from a CatalogFunction. |
static boolean |
isClassNameSerializable(UserDefinedFunction function)
Returns whether a
UserDefinedFunction can be easily serialized and identified by only
a fully qualified class name. |
static void |
prepareInstance(org.apache.flink.configuration.ReadableConfig config,
UserDefinedFunction function)
Prepares a
UserDefinedFunction instance for usage in the API. |
static void |
validateClass(Class<? extends UserDefinedFunction> functionClass)
Validates a
UserDefinedFunction class for usage in the API. |
static void |
validateClassForRuntime(Class<? extends UserDefinedFunction> functionClass,
String methodName,
Class<?>[] argumentClasses,
Class<?> outputClass,
String functionName)
Validates a
UserDefinedFunction class for usage in the runtime. |
public static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<T> getReturnTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction)
aggregateFunction - The AggregateFunction for which the accumulator type is inferred.public static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<T> getReturnTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction, org.apache.flink.api.common.typeinfo.TypeInformation<T> scalaType)
aggregateFunction - The AggregateFunction for which the accumulator type is inferred.scalaType - The implicitly inferred type of the accumulator type.public static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<ACC> getAccumulatorTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction)
aggregateFunction - The AggregateFunction for which the accumulator type is inferred.public static <T,ACC> org.apache.flink.api.common.typeinfo.TypeInformation<ACC> getAccumulatorTypeOfAggregateFunction(ImperativeAggregateFunction<T,ACC> aggregateFunction, org.apache.flink.api.common.typeinfo.TypeInformation<ACC> scalaType)
aggregateFunction - The AggregateFunction for which the accumulator type is inferred.scalaType - The implicitly inferred type of the accumulator type.public static <T> org.apache.flink.api.common.typeinfo.TypeInformation<T> getReturnTypeOfTableFunction(TableFunction<T> tableFunction)
tableFunction - The TableFunction for which the accumulator type is inferred.public static <T> org.apache.flink.api.common.typeinfo.TypeInformation<T> getReturnTypeOfTableFunction(TableFunction<T> tableFunction, org.apache.flink.api.common.typeinfo.TypeInformation<T> scalaType)
tableFunction - The TableFunction for which the accumulator type is inferred.scalaType - The implicitly inferred type of the accumulator type.public static UserDefinedFunction instantiateFunction(ClassLoader classLoader, @Nullable org.apache.flink.configuration.ReadableConfig config, String name, CatalogFunction catalogFunction)
UserDefinedFunction from a CatalogFunction.
Requires access to ReadableConfig if Python functions should be supported.
public static UserDefinedFunction instantiateFunction(Class<?> functionClass)
UserDefinedFunction assuming a JVM function with default constructor.public static void prepareInstance(org.apache.flink.configuration.ReadableConfig config,
UserDefinedFunction function)
UserDefinedFunction instance for usage in the API.public static boolean isClassNameSerializable(UserDefinedFunction function)
UserDefinedFunction can be easily serialized and identified by only
a fully qualified class name. It must have a default constructor and no serializable fields.
Other properties (such as checks for abstract classes) are validated at the entry points
of the API, see prepareInstance(ReadableConfig, UserDefinedFunction).
public static String generateInlineFunctionName(UserDefinedFunction function)
public static void validateClass(Class<? extends UserDefinedFunction> functionClass)
UserDefinedFunction class for usage in the API.
Note: This is an initial validation to indicate common errors early. The concrete
signature validation happens in the code generation when the actual DataTypes for
arguments and result are known.
public static void validateClassForRuntime(Class<? extends UserDefinedFunction> functionClass, String methodName, Class<?>[] argumentClasses, Class<?> outputClass, String functionName)
UserDefinedFunction class for usage in the runtime.
Note: This is for the final validation when actual DataTypes for arguments and
result are known.
public static UserDefinedFunction createSpecializedFunction(String functionName, FunctionDefinition definition, CallContext callContext, ClassLoader builtInClassLoader, @Nullable org.apache.flink.configuration.ReadableConfig configuration)
FunctionDefinition as an instance of UserDefinedFunction.SpecializedFunctionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.