Class RowTimeMiniBatchAssginerOperator
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.AbstractStreamOperator<RowData>
-
- org.apache.flink.table.runtime.operators.wmassigners.RowTimeMiniBatchAssginerOperator
-
- All Implemented Interfaces:
Serializable
,CheckpointListener
,Input<RowData>
,KeyContext
,KeyContextHandler
,OneInputStreamOperator<RowData,RowData>
,StreamOperator<RowData>
,StreamOperatorStateHandler.CheckpointedStreamOperator
,YieldingOperator<RowData>
public class RowTimeMiniBatchAssginerOperator extends AbstractStreamOperator<RowData> implements OneInputStreamOperator<RowData,RowData>
A stream operator that emits watermark in a given event-time interval. This mini-batch assigner works in event time, which means the watermark is forwarded from upstream but filtered by the event-time interval. The downstream operators (e.g. windows) will trigger mini-batch once the received watermark is advanced. So only the watermarks that across the event-time interval boundary (i.e. window-end) will be forwarded. This is for windows to have most efficient mini-batch.For example, if this operator receives watermarks
0,1,2,3 ..., 19, 20, 21
. The downstream operator is a 5-size window aggregate, then the mini-batch interval is 5 (this is inferred by rules). Then only4, 9, 14, 19
will be forwarded, because they are the watermarks trigger windows.The difference between this operator and
ProcTimeMiniBatchAssignerOperator
is that, this operator forwards watermarks from upstream, but the other generates watermarks by itself using processing time.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
config, lastRecordAttributes1, lastRecordAttributes2, latencyStats, LOG, metrics, output, processingTimeService, stateHandler, stateKeySelector1, stateKeySelector2, timeServiceManager
-
-
Constructor Summary
Constructors Constructor Description RowTimeMiniBatchAssginerOperator(long minibatchInterval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finish()
This method is called at the end of data processing.void
open()
This method is called immediately before any elements are processed, it should contain the operator's initialization logic, e.g. state initialization.void
processElement(StreamRecord<RowData> element)
Processes one element that arrived on this input of theMultipleInputStreamOperator
.void
processWatermark(Watermark mark)
Processes aWatermark
that arrived on the first input of this two-input operator.-
Methods inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
close, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getStateKeySelector1, getStateKeySelector2, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark1, processWatermark2, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setMailboxExecutor, setProcessingTimeService, setup, snapshotState, snapshotState, useSplittableTimers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted, notifyCheckpointComplete
-
Methods inherited from interface org.apache.flink.streaming.api.operators.Input
processLatencyMarker, processRecordAttributes, processWatermarkStatus
-
Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContext
getCurrentKey, setCurrentKey
-
Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContextHandler
hasKeyContext
-
Methods inherited from interface org.apache.flink.streaming.api.operators.OneInputStreamOperator
setKeyContextElement
-
Methods inherited from interface org.apache.flink.streaming.api.operators.StreamOperator
close, getMetricGroup, getOperatorAttributes, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
-
-
-
-
Method Detail
-
open
public void open() throws Exception
Description copied from class:AbstractStreamOperator
This method is called immediately before any elements are processed, it should contain the operator's initialization logic, e.g. state initialization.The default implementation does nothing.
- Specified by:
open
in interfaceStreamOperator<RowData>
- Overrides:
open
in classAbstractStreamOperator<RowData>
- Throws:
Exception
- An exception in this method causes the operator to fail.
-
processElement
public void processElement(StreamRecord<RowData> element) throws Exception
Description copied from interface:Input
Processes one element that arrived on this input of theMultipleInputStreamOperator
. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processElement
in interfaceInput<RowData>
- Throws:
Exception
-
processWatermark
public void processWatermark(Watermark mark) throws Exception
Description copied from interface:Input
Processes aWatermark
that arrived on the first input of this two-input operator. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processWatermark
in interfaceInput<RowData>
- Overrides:
processWatermark
in classAbstractStreamOperator<RowData>
- Throws:
Exception
- See Also:
Watermark
-
finish
public void finish() throws Exception
Description copied from interface:StreamOperator
This method is called at the end of data processing.The method is expected to flush all remaining buffered data. Exceptions during this flushing of buffered data should be propagated, in order to cause the operation to be recognized as failed, because the last data items are not processed properly.
After this method is called, no more records can be produced for the downstream operators.
WARNING: It is not safe to use this method to commit any transactions or other side effects! You can use this method to flush any buffered data that can later on be committed e.g. in a
CheckpointListener.notifyCheckpointComplete(long)
.NOTE:This method does not need to close any resources. You should release external resources in the
StreamOperator.close()
method.- Specified by:
finish
in interfaceStreamOperator<RowData>
- Overrides:
finish
in classAbstractStreamOperator<RowData>
- Throws:
Exception
- An exception in this method causes the operator to fail.
-
-