@Internal public interface SliceSharedAssigner extends SliceAssigner
SliceAssignerwhich 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.
|Modifier and Type||Interface and Description|
Callback to be used in
|Modifier and Type||Method and Description|
Determines which slices (if any) should be merged.
Returns the optional end timestamp of next window which should be triggered.
assignSliceEnd, expiredSlices, getLastWindowEnd, getSliceEndInterval, getWindowStart, isEventTime
void mergeSlices(long sliceEnd, SliceSharedAssigner.MergeCallback callback) throws Exception
sliceEnd- the triggered slice, identified by end timestamp
callback- a callback that can be invoked to signal which slices should be merged.
Optional<Long> nextTriggerWindow(long windowEnd, java.util.function.Supplier<Boolean> isWindowEmpty)
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
windowEnd- the current triggered window, identified by end timestamp
isWindowEmpty- a supplier that can be invoked to get whether the triggered window is empty (i.e. no records in the window).
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.