public class BufferedKVExternalSorter extends Object
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 and 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) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
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() |
void |
sortAndSpill(ArrayList<org.apache.flink.core.memory.MemorySegment> recordBufferSegments,
long numElements,
MemorySegmentPool pool) |
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)
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
IOExceptionpublic void sortAndSpill(ArrayList<org.apache.flink.core.memory.MemorySegment> recordBufferSegments, long numElements, MemorySegmentPool pool) throws IOException
IOExceptionpublic void close()
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.