Search in sources :

Example 1 with HgkvDirReaderImpl

use of com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReaderImpl in project hugegraph-computer by hugegraph.

the class SorterImpl method mergeInputs.

@Override
public void mergeInputs(List<String> inputs, OuterSortFlusher flusher, List<String> outputs, boolean withSubKv) throws Exception {
    InputToEntries inputToEntries;
    if (withSubKv) {
        inputToEntries = o -> new HgkvDir4SubKvReaderImpl(o).iterator();
    } else {
        inputToEntries = o -> new HgkvDirReaderImpl(o).iterator();
    }
    this.mergeInputs(inputs, inputToEntries, flusher, outputs);
}
Also used : HgkvDir4SubKvReaderImpl(com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDir4SubKvReaderImpl) HgkvDirReaderImpl(com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReaderImpl) InputToEntries(com.baidu.hugegraph.computer.core.store.hgkvfile.entry.InputToEntries)

Example 2 with HgkvDirReaderImpl

use of com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReaderImpl in project hugegraph-computer by hugegraph.

the class SorterImpl method iterator.

@Override
public PeekableIterator<KvEntry> iterator(List<String> inputs, boolean withSubKv) throws IOException {
    InputsSorterImpl sorter = new InputsSorterImpl();
    List<EntryIterator> entries = new ArrayList<>();
    for (String input : inputs) {
        HgkvDirReader reader = new HgkvDirReaderImpl(input, false, withSubKv);
        entries.add(reader.iterator());
    }
    return PeekableIteratorAdaptor.of(sorter.sort(entries));
}
Also used : HgkvDirReaderImpl(com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReaderImpl) InputsSorterImpl(com.baidu.hugegraph.computer.core.sort.sorter.InputsSorterImpl) ArrayList(java.util.ArrayList) EntryIterator(com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.EntryIterator) HgkvDirReader(com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReader)

Aggregations

HgkvDirReaderImpl (com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReaderImpl)2 InputsSorterImpl (com.baidu.hugegraph.computer.core.sort.sorter.InputsSorterImpl)1 EntryIterator (com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.EntryIterator)1 InputToEntries (com.baidu.hugegraph.computer.core.store.hgkvfile.entry.InputToEntries)1 HgkvDir4SubKvReaderImpl (com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDir4SubKvReaderImpl)1 HgkvDirReader (com.baidu.hugegraph.computer.core.store.hgkvfile.file.reader.HgkvDirReader)1 ArrayList (java.util.ArrayList)1