Package org.apache.flink.table.functions
Class FunctionContext
- java.lang.Object
-
- org.apache.flink.table.functions.FunctionContext
-
@PublicEvolving public class FunctionContext extends Object
AFunctionContextallows 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
Constructors Constructor Description FunctionContext(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilegetCachedFile(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.StringgetJobParameter(String key, String defaultValue)Gets the global job parameter value associated with the given key as a string.org.apache.flink.metrics.MetricGroupgetMetricGroup()Returns the metric group for this parallel subtask.org.apache.flink.api.common.TaskInfogetTaskInfo()Get theTaskInfofor this parallel subtask.ClassLoadergetUserCodeClassLoader()Gets theClassLoaderto load classes that are not in system's classpath, but are part of the JAR file of a user job.
-
-
-
Constructor Detail
-
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 Detail
-
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
public File getCachedFile(String name)
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
public String getJobParameter(String key, String defaultValue)
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
public ClassLoader getUserCodeClassLoader()
Gets theClassLoaderto load classes that are not in system's classpath, but are part of the JAR file of a user job.
-
-