Search in sources :

Example 1 with InputSorter

use of com.baidu.hugegraph.computer.core.sort.sorter.InputSorter 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 InputSorter

use of com.baidu.hugegraph.computer.core.sort.sorter.InputSorter 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)

Example 3 with InputSorter

use of com.baidu.hugegraph.computer.core.sort.sorter.InputSorter 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.buffer.KvEntriesInput)

Example 4 with InputSorter

use of com.baidu.hugegraph.computer.core.sort.sorter.InputSorter in project hugegraph-computer by hugegraph.

the class DefaultSorter method sortBuffer.

public void sortBuffer(EntryIterator entries, InnerSortFlusher flusher) throws Exception {
    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)

Aggregations

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