use of com.baidu.hugegraph.structure.graph.Shard in project hugegraph-computer by hugegraph.
the class HugeInputSplitFetcher method fetchEdgeInputSplits.
@Override
public List<InputSplit> fetchEdgeInputSplits() {
long splitSize = this.config.get(ComputerOptions.INPUT_SPLITS_SIZE);
int maxSplits = this.config.get(ComputerOptions.INPUT_MAX_SPLITS);
List<Shard> shards = this.client.traverser().edgeShards(splitSize);
E.checkArgument(shards.size() <= maxSplits, "Too many shards due to too small splitSize");
List<InputSplit> splits = new ArrayList<>();
for (Shard shard : shards) {
InputSplit split = new InputSplit(shard.start(), shard.end());
splits.add(split);
}
return splits;
}
use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanVertexInPaging.
@Test
public void testScanVertexInPaging() {
List<Shard> shards = verticesAPI.shards(1 * 1024 * 1024);
List<Vertex> vertices = new LinkedList<>();
for (Shard shard : shards) {
String page = "";
while (page != null) {
Vertices results = verticesAPI.scan(shard, page, DEFAULT_PAGE_LIMIT);
vertices.addAll(ImmutableList.copyOf(results.results()));
page = results.page();
}
}
Assert.assertEquals(6, vertices.size());
}
use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanVertex.
@Test
public void testScanVertex() {
List<Shard> shards = verticesAPI.shards(1 * 1024 * 1024);
List<Vertex> vertices = new LinkedList<>();
for (Shard shard : shards) {
Vertices results = verticesAPI.scan(shard, null, 0L);
vertices.addAll(ImmutableList.copyOf(results.results()));
Assert.assertNull(results.page());
}
Assert.assertEquals(6, vertices.size());
}
Aggregations