Class BinaryInMemorySortBuffer
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.sort.BinaryIndexedSortable
-
- org.apache.flink.table.runtime.operators.sort.BinaryInMemorySortBuffer
-
- All Implemented Interfaces:
IndexedSortable
public final class BinaryInMemorySortBuffer extends BinaryIndexedSortable
In memory sort buffer for binary row.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.table.runtime.operators.sort.BinaryIndexedSortable
currentSortIndexOffset, currentSortIndexSegment, indexEntrySize, lastIndexEntryOffset, memorySegmentPool, numRecords, OFFSET_LEN, recordBuffer, row1, serializer, serializer1, sortIndex
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BinaryInMemorySortBuffer
createBuffer(NormalizedKeyComputer normalizedKeyComputer, AbstractRowDataSerializer<RowData> inputSerializer, BinaryRowDataSerializer serializer, RecordComparator comparator, MemorySegmentPool memoryPool)
Create a memory sorter in `insert` way.void
dispose()
long
getCapacity()
MutableObjectIterator<BinaryRowData>
getIterator()
Gets an iterator over all records in this buffer in their logical order.long
getOccupancy()
boolean
isEmpty()
Checks whether the buffer is empty.void
reset()
Resets the sort buffer back to the state where it is empty.void
returnToSegmentPool()
boolean
write(RowData record)
Writes a given record to this sort buffer.-
Methods inherited from class org.apache.flink.table.runtime.operators.sort.BinaryIndexedSortable
checkNextIndexOffset, compare, compare, nextMemorySegment, recordSize, recordsPerSegment, size, swap, swap, writeIndexAndNormalizedKey, writeToOutput
-
-
-
-
Method Detail
-
createBuffer
public static BinaryInMemorySortBuffer createBuffer(NormalizedKeyComputer normalizedKeyComputer, AbstractRowDataSerializer<RowData> inputSerializer, BinaryRowDataSerializer serializer, RecordComparator comparator, MemorySegmentPool memoryPool)
Create a memory sorter in `insert` way.
-
reset
public void reset()
Resets the sort buffer back to the state where it is empty. All contained data is discarded.
-
returnToSegmentPool
public void returnToSegmentPool()
-
isEmpty
public boolean isEmpty()
Checks whether the buffer is empty.- Returns:
- True, if no record is contained, false otherwise.
-
dispose
public void dispose()
-
getCapacity
public long getCapacity()
-
getOccupancy
public long getOccupancy()
-
write
public boolean write(RowData record) throws IOException
Writes a given record to this sort buffer. The written record will be appended and take the last logical position.- Parameters:
record
- The record to be written.- Returns:
- True, if the record was successfully written, false, if the sort buffer was full.
- Throws:
IOException
- Thrown, if an error occurred while serializing the record into the buffers.
-
getIterator
public MutableObjectIterator<BinaryRowData> getIterator()
Gets an iterator over all records in this buffer in their logical order.- Returns:
- An iterator returning the records in their logical order.
-
-