Search in sources :

Example 1 with KvEntriesInput

use of com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.KvEntriesInput in project hugegraph-computer by hugegraph.

the class KvEntryWriterImpl method sortAndWriteSubKvs.

private void sortAndWriteSubKvs() throws IOException {
    BytesInput input = EntriesUtil.inputFromOutput(this.subKvBuffer);
    InputSorter sorter = new JavaInputSorter();
    Iterator<KvEntry> subKvs = sorter.sort(new KvEntriesInput(input));
    while (subKvs.hasNext()) {
        KvEntry subKv = subKvs.next();
        subKv.key().write(this.output);
        subKv.value().write(this.output);
    }
}
Also used : JavaInputSorter(com.baidu.hugegraph.computer.core.sort.sorter.JavaInputSorter) InputSorter(com.baidu.hugegraph.computer.core.sort.sorter.InputSorter) JavaInputSorter(com.baidu.hugegraph.computer.core.sort.sorter.JavaInputSorter) BytesInput(com.baidu.hugegraph.computer.core.io.BytesInput) KvEntriesInput(com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.KvEntriesInput)

Example 2 with KvEntriesInput

use of com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.KvEntriesInput in project hugegraph-computer by hugegraph.

the class SorterImpl method sortBuffer.

@Override
public void sortBuffer(RandomAccessInput input, InnerSortFlusher flusher, boolean withSubKv) throws Exception {
    try (EntryIterator entries = new KvEntriesInput(input, withSubKv)) {
        InputSorter sorter = new JavaInputSorter();
        flusher.flush(sorter.sort(entries));
    }
}
Also used : JavaInputSorter(com.baidu.hugegraph.computer.core.sort.sorter.JavaInputSorter) InputSorter(com.baidu.hugegraph.computer.core.sort.sorter.InputSorter) JavaInputSorter(com.baidu.hugegraph.computer.core.sort.sorter.JavaInputSorter) KvEntriesInput(com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.KvEntriesInput) EntryIterator(com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.EntryIterator)

Aggregations

InputSorter (com.baidu.hugegraph.computer.core.sort.sorter.InputSorter)2 JavaInputSorter (com.baidu.hugegraph.computer.core.sort.sorter.JavaInputSorter)2 KvEntriesInput (com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.KvEntriesInput)2 BytesInput (com.baidu.hugegraph.computer.core.io.BytesInput)1 EntryIterator (com.baidu.hugegraph.computer.core.store.hgkvfile.buffer.EntryIterator)1