Class DistributedRuntimeUDFContext
- java.lang.Object
-
- org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
- org.apache.flink.runtime.operators.util.DistributedRuntimeUDFContext
-
- All Implemented Interfaces:
RuntimeContext
public class DistributedRuntimeUDFContext extends AbstractRuntimeUDFContext
A standalone implementation of theRuntimeContext
, created by runtime UDF operators.
-
-
Constructor Summary
Constructors Constructor Description DistributedRuntimeUDFContext(JobInfo jobInfo, TaskInfo taskInfo, UserCodeClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String,Future<Path>> cpTasks, Map<String,Accumulator<?,?>> accumulators, OperatorMetricGroup metrics, ExternalResourceInfoProvider externalResourceInfoProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearAllBroadcastVariables()
void
clearBroadcastVariable(String name)
<T> List<T>
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.boolean
hasBroadcastVariable(String name)
Tests for the existence of the broadcast variable identified by the givenname
.void
setBroadcastVariable(String name, BroadcastVariableMaterialization<?,?> value)
-
Methods inherited from class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
addAccumulator, createSerializer, getAccumulator, getAggregatingState, getAllocationIDAsString, getDistributedCache, getDoubleCounter, getGlobalJobParameters, getHistogram, getIntCounter, getJobInfo, getListState, getLongCounter, getMapState, getMetricGroup, getReducingState, getState, getTaskInfo, getUserCodeClassLoader, isObjectReuseEnabled, registerUserCodeClassLoaderReleaseHookIfAbsent
-
-
-
-
Constructor Detail
-
DistributedRuntimeUDFContext
public DistributedRuntimeUDFContext(JobInfo jobInfo, TaskInfo taskInfo, UserCodeClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String,Future<Path>> cpTasks, Map<String,Accumulator<?,?>> accumulators, OperatorMetricGroup metrics, ExternalResourceInfoProvider externalResourceInfoProvider)
-
-
Method Detail
-
hasBroadcastVariable
public boolean hasBroadcastVariable(String name)
Description copied from interface:RuntimeContext
Tests 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 <T> List<T> getBroadcastVariable(String name)
Description copied from interface:RuntimeContext
Returns 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:RuntimeContext
Returns 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.
-
getExternalResourceInfos
public Set<ExternalResourceInfo> getExternalResourceInfos(String resourceName)
Description copied from interface:RuntimeContext
Get 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
-
setBroadcastVariable
public void setBroadcastVariable(String name, BroadcastVariableMaterialization<?,?> value)
-
clearBroadcastVariable
public void clearBroadcastVariable(String name)
-
clearAllBroadcastVariables
public void clearAllBroadcastVariables()
-
-