use of com.baidu.hugegraph.computer.core.sort.flusher.InnerSortFlusher in project hugegraph-computer by hugegraph.
the class SorterTest method sortedSubKvBuffer.
private BytesInput sortedSubKvBuffer(Config config) throws Exception {
List<Integer> kv1 = ImmutableList.of(3, 2, 1, 4, 1);
List<Integer> kv2 = ImmutableList.of(1, 3, 1, 5, 1);
List<Integer> kv3 = ImmutableList.of(2, 8, 1, 9, 1);
List<Integer> kv4 = ImmutableList.of(3, 2, 1, 3, 1);
List<Integer> kv5 = ImmutableList.of(2, 5, 1, 8, 1);
List<List<Integer>> data = ImmutableList.of(kv1, kv2, kv3, kv4, kv5);
BytesInput input = SorterTestUtil.inputFromSubKvMap(data);
BytesOutput output = IOFactory.createBytesOutput(Constants.SMALL_BUF_SIZE);
PointerCombiner combiner = SorterTestUtil.createPointerCombiner(IntValue::new, new IntValueSumCombiner());
int flushThreshold = config.get(ComputerOptions.INPUT_MAX_EDGES_IN_ONE_VERTEX);
InnerSortFlusher flusher = new CombineSubKvInnerSortFlusher(output, combiner, flushThreshold);
Sorter sorter = SorterTestUtil.createSorter(config);
sorter.sortBuffer(input, flusher, true);
return EntriesUtil.inputFromOutput(output);
}
Aggregations