Search in sources :

Example 1 with BufferFileEntryReader

use of com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileEntryReader in project hugegraph-computer by hugegraph.

the class BufferFileSorter method mergeInputs.

@Override
public void mergeInputs(List<String> inputs, OuterSortFlusher flusher, List<String> outputs, boolean withSubKv) throws Exception {
    Function<String, EntryIterator> fileToInput;
    Function<String, KvEntryFileWriter> fileToWriter;
    if (withSubKv) {
        fileToInput = o -> new BufferFileSubEntryReader(o).iterator();
    } else {
        fileToInput = o -> new BufferFileEntryReader(o).iterator();
    }
    fileToWriter = BufferFileEntryBuilder::new;
    InputFilesSelector selector = new DisperseEvenlySelector();
    List<SelectedFiles> selectResult = selector.selectedByBufferFile(inputs, outputs);
    this.sorter.mergeFile(selectResult, fileToInput, fileToWriter, flusher);
}
Also used : DisperseEvenlySelector(com.baidu.hugegraph.computer.core.store.file.select.DisperseEvenlySelector) BufferFileSubEntryReader(com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileSubEntryReader) BufferFileEntryReader(com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileEntryReader) SelectedFiles(com.baidu.hugegraph.computer.core.store.file.select.SelectedFiles) EntryIterator(com.baidu.hugegraph.computer.core.store.EntryIterator) BufferFileEntryBuilder(com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileEntryBuilder) KvEntryFileWriter(com.baidu.hugegraph.computer.core.store.KvEntryFileWriter) InputFilesSelector(com.baidu.hugegraph.computer.core.store.file.select.InputFilesSelector)

Aggregations

EntryIterator (com.baidu.hugegraph.computer.core.store.EntryIterator)1 KvEntryFileWriter (com.baidu.hugegraph.computer.core.store.KvEntryFileWriter)1 BufferFileEntryBuilder (com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileEntryBuilder)1 BufferFileEntryReader (com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileEntryReader)1 BufferFileSubEntryReader (com.baidu.hugegraph.computer.core.store.file.bufferfile.BufferFileSubEntryReader)1 DisperseEvenlySelector (com.baidu.hugegraph.computer.core.store.file.select.DisperseEvenlySelector)1 InputFilesSelector (com.baidu.hugegraph.computer.core.store.file.select.InputFilesSelector)1 SelectedFiles (com.baidu.hugegraph.computer.core.store.file.select.SelectedFiles)1