Class BufferedKVExternalSorter
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.sort.BufferedKVExternalSorter
-
public class BufferedKVExternalSorter extends Object
Sorter for buffered input in the form of Key-Value Style. First, sort and spill buffered inputs (without data copy, just write index and normalized key). Second, merge disk outputs and return iterator.For Hash Aggregation:We store the data in MemorySegmentHashTable in KeyValue format. When memory is not enough, we spill all the data in memory onto disk and degenerate it into Sort Aggregation. So we need a BufferedKVExternalSorter to write the data that already in memory to disk, and then carry out SortMerge.
-
-
Constructor Summary
Constructors Constructor Description BufferedKVExternalSorter(org.apache.flink.runtime.io.disk.iomanager.IOManager ioManager, BinaryRowDataSerializer keySerializer, BinaryRowDataSerializer valueSerializer, NormalizedKeyComputer nKeyComputer, RecordComparator comparator, int pageSize, int maxNumFileHandles, boolean compressionEnabled, int compressionBlockSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()org.apache.flink.util.MutableObjectIterator<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.table.data.binary.BinaryRowData,org.apache.flink.table.data.binary.BinaryRowData>>getKVIterator()voidsortAndSpill(ArrayList<org.apache.flink.core.memory.MemorySegment> recordBufferSegments, long numElements, MemorySegmentPool pool)
-
-
-
Constructor Detail
-
BufferedKVExternalSorter
public BufferedKVExternalSorter(org.apache.flink.runtime.io.disk.iomanager.IOManager ioManager, BinaryRowDataSerializer keySerializer, BinaryRowDataSerializer valueSerializer, NormalizedKeyComputer nKeyComputer, RecordComparator comparator, int pageSize, int maxNumFileHandles, boolean compressionEnabled, int compressionBlockSize)
-
-
Method Detail
-
getKVIterator
public org.apache.flink.util.MutableObjectIterator<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.table.data.binary.BinaryRowData,org.apache.flink.table.data.binary.BinaryRowData>> getKVIterator() throws IOException- Throws:
IOException
-
sortAndSpill
public void sortAndSpill(ArrayList<org.apache.flink.core.memory.MemorySegment> recordBufferSegments, long numElements, MemorySegmentPool pool) throws IOException
- Throws:
IOException
-
close
public void close()
-
-