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.
| 构造器和说明 |
|---|
BufferedKVExternalSorter(org.apache.flink.runtime.io.disk.iomanager.IOManager ioManager,
BinaryRowDataSerializer keySerializer,
BinaryRowDataSerializer valueSerializer,
NormalizedKeyComputer nKeyComputer,
RecordComparator comparator,
int pageSize,
org.apache.flink.configuration.Configuration conf) |
| 限定符和类型 | 方法和说明 |
|---|---|
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,
org.apache.flink.configuration.Configuration conf)
throws IOException
IOExceptionpublic 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–2020 The Apache Software Foundation. All rights reserved.