Class MiniBatchStreamingJoinOperator
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.AbstractStreamOperator<RowData>
-
- org.apache.flink.table.runtime.operators.join.stream.AbstractStreamingJoinOperator
-
- org.apache.flink.table.runtime.operators.join.stream.StreamingJoinOperator
-
- org.apache.flink.table.runtime.operators.join.stream.MiniBatchStreamingJoinOperator
-
- All Implemented Interfaces:
Serializable
,CheckpointListener
,KeyContext
,KeyContextHandler
,StreamOperator<RowData>
,StreamOperatorStateHandler.CheckpointedStreamOperator
,TwoInputStreamOperator<RowData,RowData,RowData>
,YieldingOperator<RowData>
,BundleTriggerCallback
public abstract class MiniBatchStreamingJoinOperator extends StreamingJoinOperator implements BundleTriggerCallback
Streaming unbounded Join base operator which support mini-batch join.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.flink.table.runtime.operators.join.stream.StreamingJoinOperator
leftIsOuter, leftRecordStateView, rightIsOuter, rightRecordStateView
-
Fields inherited from class org.apache.flink.table.runtime.operators.join.stream.AbstractStreamingJoinOperator
collector, joinCondition, LEFT_RECORDS_STATE_NAME, leftInputSideSpec, leftStateRetentionTime, leftType, RIGHT_RECORDS_STATE_NAME, rightInputSideSpec, rightStateRetentionTime, rightType
-
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 MiniBatchStreamingJoinOperator(org.apache.flink.table.runtime.operators.join.stream.MiniBatchStreamingJoinOperator.MiniBatchStreamingJoinParameter parameter)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
This method is called at the very end of the operator's life, both in the case of a successful completion of the operation, and in the case of a failure and canceling.void
finish()
This method is called at the end of data processing.void
finishBundle()
This method is invoked to finish current bundle and start a new one when the trigger was fired.static MiniBatchStreamingJoinOperator
newMiniBatchStreamJoinOperator(FlinkJoinType joinType, InternalTypeInfo<RowData> leftType, InternalTypeInfo<RowData> rightType, GeneratedJoinCondition generatedJoinCondition, JoinInputSideSpec leftInputSideSpec, JoinInputSideSpec rightInputSideSpec, boolean leftIsOuter, boolean rightIsOuter, boolean[] filterNullKeys, long leftStateRetentionTime, long rightStateRetentionTime, CoBundleTrigger<RowData,RowData> coBundleTrigger)
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
prepareSnapshotPreBarrier(long checkpointId)
This method is called when the operator should do a snapshot, before it emits its own checkpoint barrier.protected abstract void
processBundles(BufferBundle<?> leftBuffer, BufferBundle<?> rightBuffer)
void
processElement1(StreamRecord<RowData> element)
Processes one element that arrived on the first input of this two-input operator.void
processElement2(StreamRecord<RowData> element)
Processes one element that arrived on the second input of this two-input operator.protected void
processSingleSideBundles(BufferBundle<?> inputBuffer, JoinRecordStateView inputSideStateView, JoinRecordStateView otherSideStateView, boolean inputIsLeft)
RetractMsg+accumulatingMsg would be optimized which would keep sending retractMsg but do not deal with state.void
processWatermark1(Watermark mark)
Processes aWatermark
that arrived on the first input of this two-input operator.void
processWatermark2(Watermark mark)
Processes aWatermark
that arrived on the second input of this two-input operator.-
Methods inherited from class org.apache.flink.table.runtime.operators.join.stream.StreamingJoinOperator
processElement
-
Methods inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
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, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark, 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.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.StreamOperator
getMetricGroup, getOperatorAttributes, getOperatorID, initializeState, setKeyContextElement1, setKeyContextElement2, snapshotState
-
Methods inherited from interface org.apache.flink.streaming.api.operators.TwoInputStreamOperator
processLatencyMarker1, processLatencyMarker2, processRecordAttributes1, processRecordAttributes2, processWatermarkStatus1, processWatermarkStatus2
-
-
-
-
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 classStreamingJoinOperator
- Throws:
Exception
- An exception in this method causes the operator to fail.
-
processElement1
public void processElement1(StreamRecord<RowData> element) throws Exception
Description copied from interface:TwoInputStreamOperator
Processes one element 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:
processElement1
in interfaceTwoInputStreamOperator<RowData,RowData,RowData>
- Overrides:
processElement1
in classStreamingJoinOperator
- Throws:
Exception
-
processElement2
public void processElement2(StreamRecord<RowData> element) throws Exception
Description copied from interface:TwoInputStreamOperator
Processes one element that arrived on the second input of this two-input operator. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processElement2
in interfaceTwoInputStreamOperator<RowData,RowData,RowData>
- Overrides:
processElement2
in classStreamingJoinOperator
- Throws:
Exception
-
processWatermark1
public void processWatermark1(Watermark mark) throws Exception
Description copied from interface:TwoInputStreamOperator
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:
processWatermark1
in interfaceTwoInputStreamOperator<RowData,RowData,RowData>
- Overrides:
processWatermark1
in classAbstractStreamOperator<RowData>
- Throws:
Exception
- See Also:
Watermark
-
processWatermark2
public void processWatermark2(Watermark mark) throws Exception
Description copied from interface:TwoInputStreamOperator
Processes aWatermark
that arrived on the second input of this two-input operator. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processWatermark2
in interfaceTwoInputStreamOperator<RowData,RowData,RowData>
- Overrides:
processWatermark2
in classAbstractStreamOperator<RowData>
- Throws:
Exception
- See Also:
Watermark
-
prepareSnapshotPreBarrier
public void prepareSnapshotPreBarrier(long checkpointId) throws Exception
Description copied from interface:StreamOperator
This method is called when the operator should do a snapshot, before it emits its own checkpoint barrier.This method is intended not for any actual state persistence, but only for emitting some data before emitting the checkpoint barrier. Operators that maintain some small transient state that is inefficient to checkpoint (especially when it would need to be checkpointed in a re-scalable way) but can simply be sent downstream before the checkpoint. An example are opportunistic pre-aggregation operators, which have small the pre-aggregation state that is frequently flushed downstream.
Important: This method should not be used for any actual state snapshot logic, because it will inherently be within the synchronous part of the operator's checkpoint. If heavy work is done within this method, it will affect latency and downstream checkpoint alignments.
- Specified by:
prepareSnapshotPreBarrier
in interfaceStreamOperator<RowData>
- Overrides:
prepareSnapshotPreBarrier
in classAbstractStreamOperator<RowData>
- Parameters:
checkpointId
- The ID of the checkpoint.- Throws:
Exception
- Throwing an exception here causes the operator to fail and go into recovery.
-
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.
-
close
public void close() throws Exception
Description copied from interface:StreamOperator
This method is called at the very end of the operator's life, both in the case of a successful completion of the operation, and in the case of a failure and canceling.This method is expected to make a thorough effort to release all resources that the operator has acquired.
NOTE:It can not emit any records! If you need to emit records at the end of processing, do so in the
StreamOperator.finish()
method.- Specified by:
close
in interfaceStreamOperator<RowData>
- Overrides:
close
in classAbstractStreamingJoinOperator
- Throws:
Exception
-
finishBundle
public void finishBundle() throws Exception
Description copied from interface:BundleTriggerCallback
This method is invoked to finish current bundle and start a new one when the trigger was fired.- Specified by:
finishBundle
in interfaceBundleTriggerCallback
- Throws:
Exception
- This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
-
processBundles
protected abstract void processBundles(BufferBundle<?> leftBuffer, BufferBundle<?> rightBuffer) throws Exception
- Throws:
Exception
-
processSingleSideBundles
protected void processSingleSideBundles(BufferBundle<?> inputBuffer, JoinRecordStateView inputSideStateView, JoinRecordStateView otherSideStateView, boolean inputIsLeft) throws Exception
RetractMsg+accumulatingMsg would be optimized which would keep sending retractMsg but do not deal with state.- Throws:
Exception
-
newMiniBatchStreamJoinOperator
public static MiniBatchStreamingJoinOperator newMiniBatchStreamJoinOperator(FlinkJoinType joinType, InternalTypeInfo<RowData> leftType, InternalTypeInfo<RowData> rightType, GeneratedJoinCondition generatedJoinCondition, JoinInputSideSpec leftInputSideSpec, JoinInputSideSpec rightInputSideSpec, boolean leftIsOuter, boolean rightIsOuter, boolean[] filterNullKeys, long leftStateRetentionTime, long rightStateRetentionTime, CoBundleTrigger<RowData,RowData> coBundleTrigger)
-
-