Package org.apache.flink.table.functions
Class FunctionContext
java.lang.Object
org.apache.flink.table.functions.FunctionContext
A
FunctionContext allows to obtain global runtime information about the context in which
the user-defined function is executed.
The information includes the metric group, distributed cache files, and global job parameters.
Note: Depending on the call location of a function, not all information might be available. For example, during constant expression reduction the function is executed locally with minimal information.
-
Constructor Summary
ConstructorsConstructorDescriptionFunctionContext(org.apache.flink.api.common.functions.RuntimeContext context) FunctionContext(org.apache.flink.api.common.functions.RuntimeContext context, ClassLoader userClassLoader, org.apache.flink.api.common.functions.OpenContext openContext) -
Method Summary
Modifier and TypeMethodDescriptiongetCachedFile(String name) Gets the local temporary file copy of a distributed cache files.Set<org.apache.flink.api.common.externalresource.ExternalResourceInfo>getExternalResourceInfos(String resourceName) Get the external resource information.getJobParameter(String key, String defaultValue) Gets the global job parameter value associated with the given key as a string.org.apache.flink.metrics.MetricGroupReturns the metric group for this parallel subtask.org.apache.flink.api.common.TaskInfoGet theTaskInfofor this parallel subtask.Gets theClassLoaderto load classes that are not in system's classpath, but are part of the JAR file of a user job.
-
Constructor Details
-
FunctionContext
public FunctionContext(@Nullable org.apache.flink.api.common.functions.RuntimeContext context, @Nullable ClassLoader userClassLoader, @Nullable org.apache.flink.api.common.functions.OpenContext openContext) -
FunctionContext
public FunctionContext(org.apache.flink.api.common.functions.RuntimeContext context)
-
-
Method Details
-
getTaskInfo
public org.apache.flink.api.common.TaskInfo getTaskInfo()Get theTaskInfofor this parallel subtask.- Returns:
- task info for this parallel subtask.
-
getMetricGroup
public org.apache.flink.metrics.MetricGroup getMetricGroup()Returns the metric group for this parallel subtask.- Returns:
- metric group for this parallel subtask.
-
getCachedFile
Gets the local temporary file copy of a distributed cache files.- Parameters:
name- distributed cache file name- Returns:
- local temporary file copy of a distributed cache file.
-
getJobParameter
Gets the global job parameter value associated with the given key as a string.- Parameters:
key- key pointing to the associated valuedefaultValue- default value which is returned in case global job parameter is null or there is no value associated with the given key- Returns:
- (default) value associated with the given key
-
getExternalResourceInfos
public Set<org.apache.flink.api.common.externalresource.ExternalResourceInfo> getExternalResourceInfos(String resourceName) Get the external resource information. -
getUserCodeClassLoader
Gets theClassLoaderto load classes that are not in system's classpath, but are part of the JAR file of a user job.
-