public class SortMergeReader<T> extends Object implements RecordReader<T>
RecordReader
, which is already sorted by key and
sequence number, and perform a sort merge algorithm. KeyValue
s with the same key will
also be combined during sort merging.
NOTE: KeyValue
s from the same RecordReader
must not contain the same key.
RecordReader.RecordIterator<T>
Constructor and Description |
---|
SortMergeReader(List<RecordReader<KeyValue>> readers,
Comparator<org.apache.flink.table.data.RowData> userKeyComparator,
MergeFunctionWrapper<T> mergeFunctionWrapper) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the reader and should release all resources.
|
RecordReader.RecordIterator<T> |
readBatch()
Reads one batch.
|
public SortMergeReader(List<RecordReader<KeyValue>> readers, Comparator<org.apache.flink.table.data.RowData> userKeyComparator, MergeFunctionWrapper<T> mergeFunctionWrapper)
@Nullable public RecordReader.RecordIterator<T> readBatch() throws IOException
RecordReader
The returned iterator object and any contained objects may be held onto by the source for some time, so it should not be immediately reused by the reader.
readBatch
in interface RecordReader<T>
IOException
public void close() throws IOException
RecordReader
close
in interface Closeable
close
in interface AutoCloseable
close
in interface RecordReader<T>
IOException
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.