public final class RecordsWindowBuffer extends Object implements WindowBuffer
WindowBuffer
that buffers input elements in a WindowBytesMultiMap
and combines buffered elements into state when flushing.Modifier and Type | Class and Description |
---|---|
static class |
RecordsWindowBuffer.Factory
Factory to create
RecordsWindowBuffer with RecordsCombiner.Factory . |
static class |
RecordsWindowBuffer.LocalFactory
Factory to create
RecordsWindowBuffer with RecordsCombiner.LocalFactory . |
Constructor and Description |
---|
RecordsWindowBuffer(Object operatorOwner,
MemoryManager memoryManager,
long memorySize,
RecordsCombiner combineFunction,
PagedTypeSerializer<RowData> keySer,
AbstractRowDataSerializer<RowData> inputSer,
boolean requiresCopy,
java.time.ZoneId shiftTimeZone) |
Modifier and Type | Method and Description |
---|---|
void |
addElement(RowData key,
long sliceEnd,
RowData element)
Adds an element with associated key into the buffer.
|
void |
advanceProgress(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.
|
void |
close()
Release resources allocated by this buffer.
|
void |
flush()
Flushes all intermediate buffered data to the underlying backend or output stream.
|
public RecordsWindowBuffer(Object operatorOwner, MemoryManager memoryManager, long memorySize, RecordsCombiner combineFunction, PagedTypeSerializer<RowData> keySer, AbstractRowDataSerializer<RowData> inputSer, boolean requiresCopy, java.time.ZoneId shiftTimeZone)
public void addElement(RowData key, long sliceEnd, RowData element) throws Exception
WindowBuffer
It may be that adding this element fills up an internal buffer and causes the buffer flushing of a batch of internally buffered elements.
addElement
in interface WindowBuffer
key
- the key associated with the elementelement
- The element to add.Exception
- Thrown, if the element cannot be added to the buffer, or if the flushing
throws an exception.public void advanceProgress(long progress) throws Exception
WindowBuffer
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.
advanceProgress
in interface WindowBuffer
progress
- the current progress timeException
public void flush() throws Exception
WindowBuffer
flush
in interface WindowBuffer
Exception
- Thrown if the buffer cannot be flushed, or if the output stream throws an
exception.public void close() throws Exception
WindowBuffer
close
in interface WindowBuffer
Exception
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.