Class WindowsGrouping
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.window.grouping.WindowsGrouping
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
HeapWindowsGrouping
public abstract class WindowsGrouping extends Object implements Closeable
Assigning windows from the sorted input buffers.Assign windows and trigger aggregate calculation based on
WindowsGrouping. It can avoid data expansion in time sliding window case.Tumbling window case Each keyed window corresponds to only one element in the
WindowsGroupingBuffer (grouping keys, assigned windows, agg buffers).Sliding window case 1. If the assign pane optimization strategy is used, each keyed window corresponding to
WindowsGroupingbuffer contains windowsSize/paneSize number of elements (assuming 1s/24h window, there are 86400 elements). 2. Otherwise, the maximum number of elements inWindowsGroupingbuffer is the maximum number of inputs in a sliding window.In most cases, assign pane optimization should be applied, so there should not be much data in
WindowsGrouping, andHeapWindowsGroupingis basically okay.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddInputToBuffer(org.apache.flink.table.data.binary.BinaryRowData input)protected abstract voidaddIntoBuffer(org.apache.flink.table.data.binary.BinaryRowData input)voidadvanceWatermarkToTriggerAllWindows()Advance the watermark to trigger all the possible windows.RowIterator<org.apache.flink.table.data.binary.BinaryRowData>buildTriggerWindowElementsIterator()TimeWindowgetTriggerWindow()booleanhasTriggerWindow()Check if there are windows could be triggered according to the current watermark.protected abstract RowIterator<org.apache.flink.table.data.binary.BinaryRowData>newBufferIterator(int startIndex)protected abstract voidonBufferEvict(int limitIndex)voidreset()Reset for next group.protected abstract voidresetBuffer()
-
-
-
Method Detail
-
reset
public void reset()
Reset for next group.
-
addInputToBuffer
public void addInputToBuffer(org.apache.flink.table.data.binary.BinaryRowData input) throws IOException- Throws:
IOException
-
advanceWatermarkToTriggerAllWindows
public void advanceWatermarkToTriggerAllWindows()
Advance the watermark to trigger all the possible windows. It is designed to be idempotent.
-
hasTriggerWindow
public boolean hasTriggerWindow()
Check if there are windows could be triggered according to the current watermark.- Returns:
- true when there are windows to be triggered. It is designed to be idempotent.
-
buildTriggerWindowElementsIterator
public RowIterator<org.apache.flink.table.data.binary.BinaryRowData> buildTriggerWindowElementsIterator()
- Returns:
- the iterator of the next triggerable window's elements.
-
getTriggerWindow
public TimeWindow getTriggerWindow()
- Returns:
- the last triggered window.
-
resetBuffer
protected abstract void resetBuffer()
-
addIntoBuffer
protected abstract void addIntoBuffer(org.apache.flink.table.data.binary.BinaryRowData input) throws IOException- Throws:
IOException
-
onBufferEvict
protected abstract void onBufferEvict(int limitIndex)
-
newBufferIterator
protected abstract RowIterator<org.apache.flink.table.data.binary.BinaryRowData> newBufferIterator(int startIndex)
-
-