Entry
- Type of Entry to Merge sort.public abstract class AbstractBinaryExternalMerger<Entry> extends Object implements Closeable
BinaryExternalSorter
. It merges maxFanIn
spilled files
at most once.Modifier and Type | Field and Description |
---|---|
protected IOManager |
ioManager |
protected int |
pageSize |
Constructor and Description |
---|
AbstractBinaryExternalMerger(IOManager ioManager,
int pageSize,
int maxFanIn,
SpillChannelManager channelManager,
boolean compressionEnable,
BlockCompressionFactory compressionCodecFactory,
int compressionBlockSize) |
Modifier and Type | Method and Description |
---|---|
protected abstract MutableObjectIterator<Entry> |
channelReaderInputViewIterator(AbstractChannelReaderInputView inView) |
void |
close() |
BinaryMergeIterator<Entry> |
getMergingIterator(List<ChannelWithMeta> channelIDs,
List<FileIOChannel> openChannels)
Returns an iterator that iterates over the merged result from all given channels.
|
List<ChannelWithMeta> |
mergeChannelList(List<ChannelWithMeta> channelIDs)
Merges the given sorted runs to a smaller number of sorted runs.
|
protected abstract Comparator<Entry> |
mergeComparator() |
protected abstract List<Entry> |
mergeReusedEntries(int size) |
protected abstract void |
writeMergingOutput(MutableObjectIterator<Entry> mergeIterator,
AbstractPagedOutputView output)
read the merged stream and write the data back.
|
protected final int pageSize
protected final IOManager ioManager
public AbstractBinaryExternalMerger(IOManager ioManager, int pageSize, int maxFanIn, SpillChannelManager channelManager, boolean compressionEnable, BlockCompressionFactory compressionCodecFactory, int compressionBlockSize)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public BinaryMergeIterator<Entry> getMergingIterator(List<ChannelWithMeta> channelIDs, List<FileIOChannel> openChannels) throws IOException
channelIDs
- The channels that are to be merged and returned.IOException
- Thrown, if the readers encounter an I/O problem.public List<ChannelWithMeta> mergeChannelList(List<ChannelWithMeta> channelIDs) throws IOException
channelIDs
- The IDs of the sorted runs that need to be merged.IOException
- Thrown, if the readers or writers encountered an I/O problem.protected abstract MutableObjectIterator<Entry> channelReaderInputViewIterator(AbstractChannelReaderInputView inView)
protected abstract Comparator<Entry> mergeComparator()
protected abstract List<Entry> mergeReusedEntries(int size)
protected abstract void writeMergingOutput(MutableObjectIterator<Entry> mergeIterator, AbstractPagedOutputView output) throws IOException
IOException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.