@PublicEvolving public class FunctionContext extends Object
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.
| 构造器和说明 |
|---|
FunctionContext(org.apache.flink.api.common.functions.RuntimeContext context)
Wraps the underlying
RuntimeContext. |
| 限定符和类型 | 方法和说明 |
|---|---|
File |
getCachedFile(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.
|
String |
getJobParameter(String key,
String defaultValue)
Gets the global job parameter value associated with the given key as a string.
|
org.apache.flink.metrics.MetricGroup |
getMetricGroup()
Returns the metric group for this parallel subtask.
|
public FunctionContext(org.apache.flink.api.common.functions.RuntimeContext context)
RuntimeContext.context - the runtime context in which Flink's Function is executed.public org.apache.flink.metrics.MetricGroup getMetricGroup()
public File getCachedFile(String name)
name - distributed cache file namepublic String getJobParameter(String key, String defaultValue)
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 keyCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.