public static final class SliceAssigners.CumulativeSliceAssigner extends Object implements SliceSharedAssigner
SliceAssigner for cumulative windows.| Modifier | Constructor and Description |
|---|---|
protected |
CumulativeSliceAssigner(int rowtimeIndex,
ZoneId shiftTimeZone,
long maxSize,
long step,
long offset) |
| Modifier and Type | Method and Description |
|---|---|
long |
assignSliceEnd(long timestamp) |
Iterable<Long> |
expiredSlices(long windowEnd)
Returns an iterator of slices to expire when the given window is emitted.
|
String |
getDescription()
Returns a description of this window assigner.
|
long |
getLastWindowEnd(long sliceEnd)
Returns the last window which the slice belongs to.
|
long |
getSliceEndInterval()
Returns the interval of slice ends, i.e. the step size to advance of the slice end when a new
slice assigned.
|
long |
getWindowStart(long windowEnd)
Returns the corresponding window start timestamp of the given window end timestamp.
|
void |
mergeSlices(long sliceEnd,
MergeCallback<Long,Iterable<Long>> callback)
Determines which slices (if any) should be merged.
|
Optional<Long> |
nextTriggerWindow(long windowEnd,
Supplier<Boolean> isWindowEmpty)
Returns the optional end timestamp of next window which should be triggered.
|
SliceAssigners.CumulativeSliceAssigner |
withOffset(Duration offset)
Creates a new
SliceAssigners.CumulativeSliceAssigner with a new specified offset. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitassignSliceEndisEventTimeprotected CumulativeSliceAssigner(int rowtimeIndex,
ZoneId shiftTimeZone,
long maxSize,
long step,
long offset)
public SliceAssigners.CumulativeSliceAssigner withOffset(Duration offset)
SliceAssigners.CumulativeSliceAssigner with a new specified offset.public long assignSliceEnd(long timestamp)
public long getLastWindowEnd(long sliceEnd)
SliceAssignergetLastWindowEnd in interface SliceAssignerpublic long getWindowStart(long windowEnd)
SliceAssignergetWindowStart in interface SliceAssignerpublic Iterable<Long> expiredSlices(long windowEnd)
SliceAssignerexpiredSlices in interface SliceAssignerwindowEnd - the end timestamp of window emitted.public long getSliceEndInterval()
SliceAssignergetSliceEndInterval in interface SliceAssignerpublic void mergeSlices(long sliceEnd,
MergeCallback<Long,Iterable<Long>> callback)
throws Exception
SliceSharedAssignermergeSlices in interface SliceSharedAssignersliceEnd - the triggered slice, identified by end timestampcallback - a callback that can be invoked to signal which slices should be merged.Exceptionpublic Optional<Long> nextTriggerWindow(long windowEnd, Supplier<Boolean> isWindowEmpty)
SliceSharedAssignerThe 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 SliceSharedWindowAggProcessor#fireWindow(Long).
nextTriggerWindow in interface SliceSharedAssignerwindowEnd - 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).public String getDescription()
WindowAssignergetDescription in interface WindowAssignerCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.