Skip to content

Commit

Permalink
Check param capacity for NeighborRankTraverser Step (apache#1290)
Browse files Browse the repository at this point in the history
Change-Id: Ibb923021539105add400640ed495a28a12457f28
  • Loading branch information
Linary authored and tmljob committed Dec 10, 2020
1 parent 210dddc commit 08082f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public String neighborRank(@Context GraphManager manager,
"The source of rank request can't be null");
E.checkArgument(request.steps != null && !request.steps.isEmpty(),
"The steps of rank request can't be empty");
E.checkArgument(request.steps.size() <= Long.valueOf(DEFAULT_MAX_DEPTH),
E.checkArgument(request.steps.size() <= Long.parseLong(DEFAULT_MAX_DEPTH),
"The steps length of rank request can't exceed %s",
DEFAULT_MAX_DEPTH);
E.checkArgument(request.alpha > 0 && request.alpha <= 1.0,
Expand Down Expand Up @@ -107,7 +107,7 @@ private static class RankRequest {
@JsonProperty("alpha")
private double alpha;
@JsonProperty("capacity")
public long capacity = Long.valueOf(DEFAULT_CAPACITY);
public long capacity = Long.parseLong(DEFAULT_CAPACITY);

@Override
public String toString() {
Expand All @@ -124,11 +124,11 @@ private static class Step {
@JsonProperty("labels")
public List<String> labels;
@JsonProperty("degree")
public long degree = Long.valueOf(DEFAULT_DEGREE);
public long degree = Long.parseLong(DEFAULT_DEGREE);
@JsonProperty("skip_degree")
public long skipDegree = 0L;
@JsonProperty("top")
public int top = Integer.valueOf(DEFAULT_PATHS_LIMIT);
public int top = Integer.parseInt(DEFAULT_PATHS_LIMIT);

public static final int DEFAULT_CAPACITY_PER_LAYER = 100000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ public Step(HugeGraph g, Directions direction, List<String> labels,
long degree, long skipDegree, int top, int capacity) {
E.checkArgument(top > 0 && top <= MAX_TOP,
"The top of each layer can't exceed %s", MAX_TOP);

E.checkArgument(capacity > 0,
"The capacity of each layer must be > 0, " +
"but got %s", capacity);
this.edgeStep = new EdgeStep(g, direction, labels, null,
degree, skipDegree);
this.top = top;
Expand Down

0 comments on commit 08082f4

Please sign in to comment.