Class ResettableExternalBuffer
- java.lang.Object
-
- org.apache.flink.table.runtime.util.ResettableExternalBuffer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ResettableRowBuffer
public class ResettableExternalBuffer extends Object implements ResettableRowBuffer
A resettable external buffer for binary row. It stores records in memory and spill to disk when memory is not enough. When the spill is completed, the records are written to memory again. The returned iterator reads the data in write order (read spilled records first). It supports infinite length. It can open multiple Iterators. It support new iterator with beginRow.NOTE: Not supports reading while writing. In the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ResettableExternalBuffer.BufferIterator
Iterator of external buffer.-
Nested classes/interfaces inherited from interface org.apache.flink.table.runtime.util.ResettableRowBuffer
ResettableRowBuffer.ResettableIterator
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_NUM_MEMORY
The minimum number of segments that are required, 320 KibiBytes.
-
Constructor Summary
Constructors Constructor Description ResettableExternalBuffer(IOManager ioManager, LazyMemorySegmentPool pool, AbstractRowDataSerializer serializer, boolean isRowAllInFixedPart)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(RowData row)
Appends the specified row to the end of this buffer.void
close()
Delete all files and release the memory.void
complete()
Finally, complete add.int
getNumSpillFiles()
long
getSpillInBytes()
long
getUsedMemoryInBytes()
ResettableExternalBuffer.BufferIterator
newIterator()
Get a new iterator starting from first row.ResettableExternalBuffer.BufferIterator
newIterator(int beginRow)
Get a new iterator starting from the `beginRow`-th row.void
reset()
Re-initialize the buffer state.int
size()
-
-
-
Field Detail
-
MIN_NUM_MEMORY
public static final int MIN_NUM_MEMORY
The minimum number of segments that are required, 320 KibiBytes.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResettableExternalBuffer
public ResettableExternalBuffer(IOManager ioManager, LazyMemorySegmentPool pool, AbstractRowDataSerializer serializer, boolean isRowAllInFixedPart)
-
-
Method Detail
-
reset
public void reset()
Description copied from interface:ResettableRowBuffer
Re-initialize the buffer state.- Specified by:
reset
in interfaceResettableRowBuffer
-
add
public void add(RowData row) throws IOException
Description copied from interface:ResettableRowBuffer
Appends the specified row to the end of this buffer.- Specified by:
add
in interfaceResettableRowBuffer
- Throws:
IOException
-
complete
public void complete()
Description copied from interface:ResettableRowBuffer
Finally, complete add.- Specified by:
complete
in interfaceResettableRowBuffer
-
newIterator
public ResettableExternalBuffer.BufferIterator newIterator()
Description copied from interface:ResettableRowBuffer
Get a new iterator starting from first row.- Specified by:
newIterator
in interfaceResettableRowBuffer
-
newIterator
public ResettableExternalBuffer.BufferIterator newIterator(int beginRow)
Description copied from interface:ResettableRowBuffer
Get a new iterator starting from the `beginRow`-th row. `beginRow` is 0-indexed.- Specified by:
newIterator
in interfaceResettableRowBuffer
-
close
public void close()
Delete all files and release the memory.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
size
public int size()
-
getUsedMemoryInBytes
public long getUsedMemoryInBytes()
-
getNumSpillFiles
public int getNumSpillFiles()
-
getSpillInBytes
public long getSpillInBytes()
-
-