Class RecordsWindowBuffer
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.aggregate.window.buffers.RecordsWindowBuffer
-
- All Implemented Interfaces:
WindowBuffer
public final class RecordsWindowBuffer extends Object implements WindowBuffer
An implementation ofWindowBufferthat buffers input elements in aWindowBytesMultiMapand combines buffered elements into state when flushing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRecordsWindowBuffer.FactoryFactory to createRecordsWindowBufferwithRecordsCombiner.Factory.static classRecordsWindowBuffer.LocalFactoryFactory to createRecordsWindowBufferwithRecordsCombiner.LocalFactory.
-
Constructor Summary
Constructors Constructor Description RecordsWindowBuffer(Object operatorOwner, org.apache.flink.runtime.memory.MemoryManager memoryManager, long memorySize, RecordsCombiner combineFunction, PagedTypeSerializer<org.apache.flink.table.data.RowData> keySer, AbstractRowDataSerializer<org.apache.flink.table.data.RowData> inputSer, boolean requiresCopy, ZoneId shiftTimeZone)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddElement(org.apache.flink.table.data.RowData key, long sliceEnd, org.apache.flink.table.data.RowData element)Adds an element with associated key into the buffer.voidadvanceProgress(long progress)Advances the progress time, the progress time is watermark if working in event-time mode, or current processing time if working in processing-time mode.voidclose()Release resources allocated by this buffer.voidflush()Flushes all intermediate buffered data to the underlying backend or output stream.
-
-
-
Constructor Detail
-
RecordsWindowBuffer
public RecordsWindowBuffer(Object operatorOwner, org.apache.flink.runtime.memory.MemoryManager memoryManager, long memorySize, RecordsCombiner combineFunction, PagedTypeSerializer<org.apache.flink.table.data.RowData> keySer, AbstractRowDataSerializer<org.apache.flink.table.data.RowData> inputSer, boolean requiresCopy, ZoneId shiftTimeZone)
-
-
Method Detail
-
addElement
public void addElement(org.apache.flink.table.data.RowData key, long sliceEnd, org.apache.flink.table.data.RowData element) throws ExceptionDescription copied from interface:WindowBufferAdds an element with associated key into the buffer. The buffer may temporarily buffer the element, or immediately write it to the stream.It may be that adding this element fills up an internal buffer and causes the buffer flushing of a batch of internally buffered elements.
- Specified by:
addElementin interfaceWindowBuffer- Parameters:
key- the key associated with the elementelement- The element to add.- Throws:
Exception- Thrown, if the element cannot be added to the buffer, or if the flushing throws an exception.
-
advanceProgress
public void advanceProgress(long progress) throws ExceptionDescription copied from interface:WindowBufferAdvances the progress time, the progress time is watermark if working in event-time mode, or current processing time if working in processing-time mode.This will potentially flush buffered data into states or to the output stream, because the watermark advancement may be in a very small step, but we don't need to flush buffered data for every watermark advancement.
- Specified by:
advanceProgressin interfaceWindowBuffer- Parameters:
progress- the current progress time- Throws:
Exception
-
flush
public void flush() throws ExceptionDescription copied from interface:WindowBufferFlushes all intermediate buffered data to the underlying backend or output stream.- Specified by:
flushin interfaceWindowBuffer- Throws:
Exception- Thrown if the buffer cannot be flushed, or if the output stream throws an exception.
-
close
public void close() throws ExceptionDescription copied from interface:WindowBufferRelease resources allocated by this buffer.- Specified by:
closein interfaceWindowBuffer- Throws:
Exception
-
-