Class BinaryInMemorySortBuffer
java.lang.Object
org.apache.flink.table.runtime.operators.sort.BinaryIndexedSortable
org.apache.flink.table.runtime.operators.sort.BinaryInMemorySortBuffer
- All Implemented Interfaces:
org.apache.flink.runtime.operators.sort.IndexedSortable
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
Modifier and TypeMethodDescriptionstatic BinaryInMemorySortBuffercreateBuffer(NormalizedKeyComputer normalizedKeyComputer, AbstractRowDataSerializer<org.apache.flink.table.data.RowData> inputSerializer, BinaryRowDataSerializer serializer, RecordComparator comparator, MemorySegmentPool memoryPool) Create a memory sorter in `insert` way.voiddispose()longorg.apache.flink.util.MutableObjectIterator<org.apache.flink.table.data.binary.BinaryRowData>Gets an iterator over all records in this buffer in their logical order.longbooleanisEmpty()Checks whether the buffer is empty.voidreset()Resets the sort buffer back to the state where it is empty.voidbooleanwrite(org.apache.flink.table.data.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 Details
-
createBuffer
public static BinaryInMemorySortBuffer createBuffer(NormalizedKeyComputer normalizedKeyComputer, AbstractRowDataSerializer<org.apache.flink.table.data.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
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 org.apache.flink.util.MutableObjectIterator<org.apache.flink.table.data.binary.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.
-