Interface SliceSharedAssigner
- All Superinterfaces:
Serializable,SliceAssigner,WindowAssigner
- All Known Implementing Classes:
SliceAssigners.CumulativeSliceAssigner,SliceAssigners.HoppingSliceAssigner,SliceAssigners.SlicedSharedSliceAssigner
A
SliceAssigner which shares slices for windows, which means a window is divided into
multiple slices and need to merge the slices into windows when emitting windows.
Classical window of SliceSharedAssigner is hopping window.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>> asyncMergeSlices(long sliceEnd, AsyncMergeCallback<Long, Iterable<Long>> callback) Determines which slices (if any) should be merged and then merge them.voidmergeSlices(long sliceEnd, MergeCallback<Long, Iterable<Long>> callback) Determines which slices (if any) should be merged and then merge them.nextTriggerWindow(long windowEnd, Supplier<Boolean> isWindowEmpty) Returns the optional end timestamp of next window which should be triggered.nextTriggerWindow(long windowEnd, org.apache.flink.table.data.RowData acc, Function<org.apache.flink.table.data.RowData, Boolean> isWindowEmpty) Methods inherited from interface org.apache.flink.table.runtime.operators.window.tvf.slicing.SliceAssigner
assignSliceEnd, expiredSlices, getLastWindowEnd, getSliceEndInterval, getWindowStartMethods inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.WindowAssigner
getDescription, isEventTime
-
Method Details
-
mergeSlices
Determines which slices (if any) should be merged and then merge them.- Parameters:
sliceEnd- the triggered slice, identified by end timestampcallback- a callback that can be invoked to signal which slices should be merged.- Throws:
Exception
-
asyncMergeSlices
org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>> asyncMergeSlices(long sliceEnd, AsyncMergeCallback<Long, Iterable<Long>> callback) throws ExceptionDetermines which slices (if any) should be merged and then merge them.- Parameters:
sliceEnd- the triggered slice, identified by end timestampcallback- a callback that can be invoked to signal which slices should be merged.- Returns:
- f0 is the accumulators after merging, f1 is the result of the aggregation from the merged accumulators with this slice end as namespace
- Throws:
Exception
-
nextTriggerWindow
Returns the optional end timestamp of next window which should be triggered. Empty if no following window to trigger for now.The purpose of this method is avoid register too many timers for each hopping and cumulative slice, e.g. HOP(1day, 10s) needs register 8640 timers for every slice. In order to improve this, we only register one timer for the next window. For hopping windows we don't register next window if current window is empty (i.e. no records in current window). That means we will have one more unnecessary window triggered for hopping windows if no elements arrives for a key for a long time. We will skip to emit window result for the triggered empty window, see
AsyncStateSliceSharedWindowAggProcessor#fireWindow(Long, Long).- Parameters:
windowEnd- the current triggered window, identified by end timestampisWindowEmpty- a supplier that can be invoked to get whether the triggered window is empty (i.e. no records in the window).
-
nextTriggerWindow
-