public abstract class AbstractBroadcastWrapperOperator<T,S extends org.apache.flink.streaming.api.operators.StreamOperator<T>> extends Object implements org.apache.flink.streaming.api.operators.StreamOperator<T>, org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator
Note that not all instances of AbstractBroadcastWrapperOperator
need to access the
broadcast variables. If one instance of AbstractBroadcastWrapperOperator
does not contain
a rich function, then it can directly process the input without waiting for the broadcast
variables.
Modifier and Type | Field and Description |
---|---|
protected org.apache.flink.streaming.runtime.tasks.StreamTask<?,?> |
containingTask |
protected int |
indexOfSubtask
Index of this subtask.
|
protected org.apache.flink.metrics.groups.OperatorMetricGroup |
metrics |
protected int |
numInputs
Number of the inputs of this operator.
|
protected org.apache.flink.streaming.api.operators.StreamOperatorFactory<T> |
operatorFactory |
protected org.apache.flink.streaming.api.operators.Output<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<T>> |
output |
protected org.apache.flink.streaming.api.operators.StreamOperatorParameters<T> |
parameters |
protected org.apache.flink.streaming.api.operators.StreamOperatorStateHandler |
stateHandler |
protected org.apache.flink.streaming.api.graph.StreamConfig |
streamConfig |
protected org.apache.flink.streaming.api.operators.InternalTimeServiceManager<?> |
timeServiceManager |
protected S |
wrappedOperator |
Modifier and Type | Method and Description |
---|---|
protected boolean |
areBroadcastVariablesReady()
Checks whether all broadcast variables are ready.
|
void |
close() |
protected void |
endInputX(int inputIndex,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> elementConsumer,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.api.watermark.Watermark,Exception> watermarkConsumer,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> keyContextSetter)
Extracts common processing logic in subclasses' endInput(...).
|
void |
finish() |
Object |
getCurrentKey() |
org.apache.flink.metrics.groups.OperatorMetricGroup |
getMetricGroup() |
org.apache.flink.runtime.jobgraph.OperatorID |
getOperatorID() |
void |
initializeState(org.apache.flink.runtime.state.StateInitializationContext stateInitializationContext) |
void |
initializeState(org.apache.flink.streaming.api.operators.StreamTaskStateInitializer streamTaskStateManager) |
void |
notifyCheckpointAborted(long checkpointId) |
void |
notifyCheckpointComplete(long checkpointId) |
void |
open() |
void |
prepareSnapshotPreBarrier(long checkpointId) |
protected void |
processElementX(org.apache.flink.streaming.runtime.streamrecord.StreamRecord streamRecord,
int inputIndex,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> elementConsumer,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.api.watermark.Watermark,Exception> watermarkConsumer,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> keyContextSetter)
Extracts common processing logic in subclasses' processing elements.
|
protected void |
processWatermarkX(org.apache.flink.streaming.api.watermark.Watermark watermark,
int inputIndex,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> elementConsumer,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.api.watermark.Watermark,Exception> watermarkConsumer,
org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> keyContextSetter)
Extracts common processing logic in subclasses' processing watermarks.
|
void |
setCurrentKey(Object key) |
void |
setKeyContextElement1(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<?> record) |
void |
setKeyContextElement2(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<?> record) |
org.apache.flink.streaming.api.operators.OperatorSnapshotFutures |
snapshotState(long checkpointId,
long timestamp,
org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions,
org.apache.flink.runtime.state.CheckpointStreamFactory storageLocation) |
void |
snapshotState(org.apache.flink.runtime.state.StateSnapshotContext stateSnapshotContext) |
protected final org.apache.flink.streaming.api.operators.StreamOperatorParameters<T> parameters
protected final org.apache.flink.streaming.api.graph.StreamConfig streamConfig
protected final org.apache.flink.streaming.runtime.tasks.StreamTask<?,?> containingTask
protected final org.apache.flink.streaming.api.operators.Output<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<T>> output
protected final org.apache.flink.streaming.api.operators.StreamOperatorFactory<T> operatorFactory
protected final org.apache.flink.metrics.groups.OperatorMetricGroup metrics
protected final S extends org.apache.flink.streaming.api.operators.StreamOperator<T> wrappedOperator
protected transient org.apache.flink.streaming.api.operators.StreamOperatorStateHandler stateHandler
protected transient org.apache.flink.streaming.api.operators.InternalTimeServiceManager<?> timeServiceManager
protected transient int indexOfSubtask
protected int numInputs
protected boolean areBroadcastVariablesReady()
BroadcastContext.isCacheFinished(...)
repeatedly. Finally, it sets broadcast variables for {wrappedOperatorRuntimeContext} if the
broadcast variables are ready.protected void processElementX(org.apache.flink.streaming.runtime.streamrecord.StreamRecord streamRecord, int inputIndex, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> elementConsumer, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.api.watermark.Watermark,Exception> watermarkConsumer, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> keyContextSetter) throws Exception
streamRecord
- the input record.inputIndex
- input id, starts from zero.elementConsumer
- the consumer function of StreamRecord, i.e.,
operator.processElement(...).watermarkConsumer
- the consumer function of WaterMark, i.e.,
operator.processWatermark(...).keyContextSetter
- the consumer function of setting key context, i.e.,
operator.setKeyContext(...).Exception
- possible exception.protected void processWatermarkX(org.apache.flink.streaming.api.watermark.Watermark watermark, int inputIndex, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> elementConsumer, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.api.watermark.Watermark,Exception> watermarkConsumer, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> keyContextSetter) throws Exception
watermark
- the input watermark.inputIndex
- input id, starts from zero.elementConsumer
- the consumer function of StreamRecord, i.e.,
operator.processElement(...).watermarkConsumer
- the consumer function of WaterMark, i.e.,
operator.processWatermark(...).keyContextSetter
- the consumer function of setting key context, i.e.,
operator.setKeyContext(...).Exception
- possible exception.protected void endInputX(int inputIndex, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> elementConsumer, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.api.watermark.Watermark,Exception> watermarkConsumer, org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord,Exception> keyContextSetter) throws Exception
inputIndex
- input id, starts from zero.elementConsumer
- the consumer function of StreamRecord, i.e.,
operator.processElement(...).watermarkConsumer
- the consumer function of WaterMark, i.e.,
operator.processWatermark(...).keyContextSetter
- the consumer function of setting key context, i.e.,
operator.setKeyContext(...).Exception
- possible exception.public void open() throws Exception
public void close() throws Exception
public void finish() throws Exception
public void prepareSnapshotPreBarrier(long checkpointId) throws Exception
public void initializeState(org.apache.flink.streaming.api.operators.StreamTaskStateInitializer streamTaskStateManager) throws Exception
public org.apache.flink.streaming.api.operators.OperatorSnapshotFutures snapshotState(long checkpointId, long timestamp, org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions, org.apache.flink.runtime.state.CheckpointStreamFactory storageLocation) throws Exception
public void initializeState(org.apache.flink.runtime.state.StateInitializationContext stateInitializationContext) throws Exception
initializeState
in interface org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator
Exception
public void snapshotState(org.apache.flink.runtime.state.StateSnapshotContext stateSnapshotContext) throws Exception
snapshotState
in interface org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator
Exception
public void setKeyContextElement1(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<?> record) throws Exception
public void setKeyContextElement2(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<?> record) throws Exception
public org.apache.flink.metrics.groups.OperatorMetricGroup getMetricGroup()
getMetricGroup
in interface org.apache.flink.streaming.api.operators.StreamOperator<T>
public org.apache.flink.runtime.jobgraph.OperatorID getOperatorID()
getOperatorID
in interface org.apache.flink.streaming.api.operators.StreamOperator<T>
public void notifyCheckpointComplete(long checkpointId) throws Exception
notifyCheckpointComplete
in interface org.apache.flink.api.common.state.CheckpointListener
Exception
public void notifyCheckpointAborted(long checkpointId) throws Exception
notifyCheckpointAborted
in interface org.apache.flink.api.common.state.CheckpointListener
Exception
public void setCurrentKey(Object key)
setCurrentKey
in interface org.apache.flink.streaming.api.operators.KeyContext
public Object getCurrentKey()
getCurrentKey
in interface org.apache.flink.streaming.api.operators.KeyContext
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.