Class ResettableExternalBuffer
java.lang.Object
org.apache.flink.table.runtime.util.ResettableExternalBuffer
- All Implemented Interfaces:
Closeable,AutoCloseable,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 ClassesModifier and TypeClassDescriptionclassIterator of external buffer.Nested classes/interfaces inherited from interface org.apache.flink.table.runtime.util.ResettableRowBuffer
ResettableRowBuffer.ResettableIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe minimum number of segments that are required, 320 KibiBytes. -
Constructor Summary
ConstructorsConstructorDescriptionResettableExternalBuffer(org.apache.flink.runtime.io.disk.iomanager.IOManager ioManager, LazyMemorySegmentPool pool, AbstractRowDataSerializer serializer, boolean isRowAllInFixedPart) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.apache.flink.table.data.RowData row) Appends the specified row to the end of this buffer.voidclose()Delete all files and release the memory.voidcomplete()Finally, complete add.intlonglongGet a new iterator starting from first row.newIterator(int beginRow) Get a new iterator starting from the `beginRow`-th row.voidreset()Re-initialize the buffer state.intsize()
-
Field Details
-
MIN_NUM_MEMORY
public static final int MIN_NUM_MEMORYThe minimum number of segments that are required, 320 KibiBytes.- See Also:
-
-
Constructor Details
-
ResettableExternalBuffer
public ResettableExternalBuffer(org.apache.flink.runtime.io.disk.iomanager.IOManager ioManager, LazyMemorySegmentPool pool, AbstractRowDataSerializer serializer, boolean isRowAllInFixedPart)
-
-
Method Details
-
reset
public void reset()Description copied from interface:ResettableRowBufferRe-initialize the buffer state.- Specified by:
resetin interfaceResettableRowBuffer
-
add
Description copied from interface:ResettableRowBufferAppends the specified row to the end of this buffer.- Specified by:
addin interfaceResettableRowBuffer- Throws:
IOException
-
complete
public void complete()Description copied from interface:ResettableRowBufferFinally, complete add.- Specified by:
completein interfaceResettableRowBuffer
-
newIterator
Description copied from interface:ResettableRowBufferGet a new iterator starting from first row.- Specified by:
newIteratorin interfaceResettableRowBuffer
-
newIterator
Description copied from interface:ResettableRowBufferGet a new iterator starting from the `beginRow`-th row. `beginRow` is 0-indexed.- Specified by:
newIteratorin interfaceResettableRowBuffer
-
close
public void close()Delete all files and release the memory.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
size
public int size() -
getUsedMemoryInBytes
public long getUsedMemoryInBytes() -
getNumSpillFiles
public int getNumSpillFiles() -
getSpillInBytes
public long getSpillInBytes()
-