Search in sources :

Example 1 with VertexValueCombiner

use of com.baidu.hugegraph.computer.core.combiner.VertexValueCombiner in project hugegraph-computer by hugegraph.

the class SortManager method createSortFlusher.

private InnerSortFlusher createSortFlusher(MessageType type, RandomAccessOutput output, int flushThreshold) {
    PointerCombiner combiner;
    boolean needSortSubKv;
    switch(type) {
        case VERTEX:
            combiner = new VertexValueCombiner(this.context);
            needSortSubKv = false;
            break;
        case EDGE:
            combiner = new EdgeValueCombiner(this.context);
            needSortSubKv = true;
            break;
        case MSG:
            combiner = this.createMessageCombiner();
            needSortSubKv = false;
            break;
        default:
            throw new ComputerException("Unsupported combine message " + "type for %s", type);
    }
    InnerSortFlusher flusher;
    if (combiner == null) {
        flusher = new KvInnerSortFlusher(output);
    } else {
        if (needSortSubKv) {
            flusher = new CombineSubKvInnerSortFlusher(output, combiner, flushThreshold);
        } else {
            flusher = new CombineKvInnerSortFlusher(output, combiner);
        }
    }
    return flusher;
}
Also used : CombineSubKvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.CombineSubKvInnerSortFlusher) KvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.KvInnerSortFlusher) CombineKvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.CombineKvInnerSortFlusher) CombineSubKvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.CombineSubKvInnerSortFlusher) CombineSubKvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.CombineSubKvInnerSortFlusher) KvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.KvInnerSortFlusher) CombineKvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.CombineKvInnerSortFlusher) InnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.InnerSortFlusher) EdgeValueCombiner(com.baidu.hugegraph.computer.core.combiner.EdgeValueCombiner) VertexValueCombiner(com.baidu.hugegraph.computer.core.combiner.VertexValueCombiner) PointerCombiner(com.baidu.hugegraph.computer.core.combiner.PointerCombiner) ComputerException(com.baidu.hugegraph.computer.core.common.exception.ComputerException) CombineKvInnerSortFlusher(com.baidu.hugegraph.computer.core.sort.flusher.CombineKvInnerSortFlusher)

Aggregations

EdgeValueCombiner (com.baidu.hugegraph.computer.core.combiner.EdgeValueCombiner)1 PointerCombiner (com.baidu.hugegraph.computer.core.combiner.PointerCombiner)1 VertexValueCombiner (com.baidu.hugegraph.computer.core.combiner.VertexValueCombiner)1 ComputerException (com.baidu.hugegraph.computer.core.common.exception.ComputerException)1 CombineKvInnerSortFlusher (com.baidu.hugegraph.computer.core.sort.flusher.CombineKvInnerSortFlusher)1 CombineSubKvInnerSortFlusher (com.baidu.hugegraph.computer.core.sort.flusher.CombineSubKvInnerSortFlusher)1 InnerSortFlusher (com.baidu.hugegraph.computer.core.sort.flusher.InnerSortFlusher)1 KvInnerSortFlusher (com.baidu.hugegraph.computer.core.sort.flusher.KvInnerSortFlusher)1