Class RuntimeUDFContext
- java.lang.Object
-
- org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
- org.apache.flink.api.common.functions.util.RuntimeUDFContext
-
- All Implemented Interfaces:
RuntimeContext
@Internal public class RuntimeUDFContext extends AbstractRuntimeUDFContext
A standalone implementation of theRuntimeContext, created by runtime UDF operators. Used mostly in CollectionExecutor and can be removed along with the DataSet API.
-
-
Constructor Summary
Constructors Constructor Description RuntimeUDFContext(TaskInfo taskInfo, ClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String,Future<Path>> cpTasks, Map<String,Accumulator<?,?>> accumulators, org.apache.flink.metrics.groups.OperatorMetricGroup metrics)RuntimeUDFContext(TaskInfo taskInfo, ClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String,Future<Path>> cpTasks, Map<String,Accumulator<?,?>> accumulators, org.apache.flink.metrics.groups.OperatorMetricGroup metrics, JobID jobID)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAllBroadcastVariables()voidclearBroadcastVariable(String name)<RT> List<RT>getBroadcastVariable(String name)Returns the result bound to the broadcast variable identified by the givenname.<T,C>
CgetBroadcastVariableWithInitializer(String name, BroadcastVariableInitializer<T,C> initializer)Returns the result bound to the broadcast variable identified by the givenname.Set<ExternalResourceInfo>getExternalResourceInfos(String resourceName)Get the specific external resource information by the resourceName.JobIDgetJobId()The ID of the current job.booleanhasBroadcastVariable(String name)Tests for the existence of the broadcast variable identified by the givenname.voidsetBroadcastVariable(String name, List<?> value)-
Methods inherited from class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
addAccumulator, getAccumulator, getAggregatingState, getAllocationIDAsString, getAttemptNumber, getDistributedCache, getDoubleCounter, getExecutionConfig, getHistogram, getIndexOfThisSubtask, getIntCounter, getListState, getLongCounter, getMapState, getMaxNumberOfParallelSubtasks, getMetricGroup, getNumberOfParallelSubtasks, getReducingState, getState, getTaskName, getTaskNameWithSubtasks, getUserCodeClassLoader, registerUserCodeClassLoaderReleaseHookIfAbsent
-
-
-
-
Constructor Detail
-
RuntimeUDFContext
@VisibleForTesting public RuntimeUDFContext(TaskInfo taskInfo, ClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String,Future<Path>> cpTasks, Map<String,Accumulator<?,?>> accumulators, org.apache.flink.metrics.groups.OperatorMetricGroup metrics)
-
RuntimeUDFContext
public RuntimeUDFContext(TaskInfo taskInfo, ClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String,Future<Path>> cpTasks, Map<String,Accumulator<?,?>> accumulators, org.apache.flink.metrics.groups.OperatorMetricGroup metrics, JobID jobID)
-
-
Method Detail
-
hasBroadcastVariable
public boolean hasBroadcastVariable(String name)
Description copied from interface:RuntimeContextTests for the existence of the broadcast variable identified by the givenname.- Parameters:
name- The name under which the broadcast variable is registered;- Returns:
- Whether a broadcast variable exists for the given name.
-
getBroadcastVariable
public <RT> List<RT> getBroadcastVariable(String name)
Description copied from interface:RuntimeContextReturns the result bound to the broadcast variable identified by the givenname.IMPORTANT: The broadcast variable data structure is shared between the parallel tasks on one machine. Any access that modifies its internal state needs to be manually synchronized by the caller.
- Parameters:
name- The name under which the broadcast variable is registered;- Returns:
- The broadcast variable, materialized as a list of elements.
-
getBroadcastVariableWithInitializer
public <T,C> C getBroadcastVariableWithInitializer(String name, BroadcastVariableInitializer<T,C> initializer)
Description copied from interface:RuntimeContextReturns the result bound to the broadcast variable identified by the givenname. The broadcast variable is returned as a shared data structure that is initialized with the givenBroadcastVariableInitializer.IMPORTANT: The broadcast variable data structure is shared between the parallel tasks on one machine. Any access that modifies its internal state needs to be manually synchronized by the caller.
- Parameters:
name- The name under which the broadcast variable is registered;initializer- The initializer that creates the shared data structure of the broadcast variable from the sequence of elements.- Returns:
- The broadcast variable, materialized as a list of elements.
-
getJobId
public JobID getJobId()
Description copied from interface:RuntimeContextThe ID of the current job. Note that Job ID can change in particular upon manual restart. The returned ID should NOT be used for any job management tasks.
-
getExternalResourceInfos
public Set<ExternalResourceInfo> getExternalResourceInfos(String resourceName)
Description copied from interface:RuntimeContextGet the specific external resource information by the resourceName.- Parameters:
resourceName- of the required external resource- Returns:
- information set of the external resource identified by the resourceName
-
clearBroadcastVariable
public void clearBroadcastVariable(String name)
-
clearAllBroadcastVariables
public void clearAllBroadcastVariables()
-
-