Class SliceAssigners.SlicedSharedSliceAssigner
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.window.tvf.slicing.SliceAssigners.SlicedSharedSliceAssigner
-
- All Implemented Interfaces:
Serializable
,WindowAssigner
,SliceAssigner
,SliceSharedAssigner
- Enclosing class:
- SliceAssigners
public static final class SliceAssigners.SlicedSharedSliceAssigner extends Object implements SliceSharedAssigner
TheSliceAssigner
for elements have been attached slice end timestamp, and the slices are shared.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SlicedSharedSliceAssigner(int sliceEndIndex, SliceSharedAssigner innerAssigner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDescription()
Returns a description of this window assigner.long
getLastWindowEnd(long sliceEnd)
Returns the last window which the slice belongs to.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.-
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.table.runtime.operators.window.tvf.slicing.SliceAssigner
assignSliceEnd, expiredSlices, getSliceEndInterval, getWindowStart
-
Methods inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.WindowAssigner
isEventTime
-
-
-
-
Constructor Detail
-
SlicedSharedSliceAssigner
public SlicedSharedSliceAssigner(int sliceEndIndex, SliceSharedAssigner innerAssigner)
-
-
Method Detail
-
mergeSlices
public void mergeSlices(long sliceEnd, MergeCallback<Long,Iterable<Long>> callback) throws Exception
Description copied from interface:SliceSharedAssigner
Determines which slices (if any) should be merged.- Specified by:
mergeSlices
in interfaceSliceSharedAssigner
- Parameters:
sliceEnd
- the triggered slice, identified by end timestampcallback
- a callback that can be invoked to signal which slices should be merged.- Throws:
Exception
-
nextTriggerWindow
public Optional<Long> nextTriggerWindow(long windowEnd, Supplier<Boolean> isWindowEmpty)
Description copied from interface:SliceSharedAssigner
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
SliceSharedWindowAggProcessor#fireWindow(Long)
.- Specified by:
nextTriggerWindow
in interfaceSliceSharedAssigner
- 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).
-
getLastWindowEnd
public long getLastWindowEnd(long sliceEnd)
Description copied from interface:SliceAssigner
Returns the last window which the slice belongs to. The window and slices are both identified by the end timestamp.- Specified by:
getLastWindowEnd
in interfaceSliceAssigner
-
getDescription
public String getDescription()
Description copied from interface:WindowAssigner
Returns a description of this window assigner.- Specified by:
getDescription
in interfaceWindowAssigner
-
-