@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.
Constructor and Description |
---|
FunctionContext(org.apache.flink.api.common.functions.RuntimeContext context)
Wraps the underlying
RuntimeContext . |
Modifier and Type | Method and Description |
---|---|
File |
getCachedFile(String name)
Gets the local temporary file copy of a distributed cache files.
|
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–2019 The Apache Software Foundation. All rights reserved.