You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by je...@apache.org on 2022/11/01 12:30:12 UTC

[incubator-hugegraph-toolchain] branch master updated: change limit type long to int (#349)

This is an automated email from the ASF dual-hosted git repository.

jermy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git


The following commit(s) were added to refs/heads/master by this push:
     new 12a490e0 change limit type long to int (#349)
12a490e0 is described below

commit 12a490e087aed7a37290c00e2ec0fcb6d2c84948
Author: zyxxoo <va...@zoom.us>
AuthorDate: Tue Nov 1 20:30:06 2022 +0800

    change limit type long to int (#349)
    
    Co-authored-by: imbajin <ji...@apache.org>
---
 .../hugegraph/api/traverser/CrosspointsAPI.java    |  2 +-
 .../hugegraph/api/traverser/KneighborAPI.java      |  2 +-
 .../com/baidu/hugegraph/api/traverser/KoutAPI.java |  2 +-
 .../baidu/hugegraph/api/traverser/PathsAPI.java    |  2 +-
 .../hugegraph/api/traverser/PersonalRankAPI.java   |  4 +--
 .../com/baidu/hugegraph/api/traverser/RaysAPI.java |  2 +-
 .../baidu/hugegraph/api/traverser/RingsAPI.java    |  2 +-
 .../hugegraph/api/traverser/SameNeighborsAPI.java  |  2 +-
 .../api/traverser/SingleSourceShortestPathAPI.java |  2 +-
 .../hugegraph/api/traverser/TraversersAPI.java     |  2 +-
 .../baidu/hugegraph/driver/TraverserManager.java   | 24 ++++++-------
 .../hugegraph/structure/constant/Traverser.java    |  8 ++---
 .../structure/traverser/CrosspointsRequest.java    |  4 +--
 .../traverser/CustomizedPathsRequest.java          |  4 +--
 .../traverser/FusiformSimilarityRequest.java       |  4 +--
 .../structure/traverser/KneighborRequest.java      |  4 +--
 .../hugegraph/structure/traverser/KoutRequest.java |  4 +--
 .../structure/traverser/PathsRequest.java          |  4 +--
 .../structure/traverser/TemplatePathsRequest.java  |  4 +--
 .../hugegraph/api/traverser/KneighborApiTest.java  |  2 +-
 .../baidu/hugegraph/api/traverser/KoutApiTest.java | 12 +++----
 .../hugegraph/api/traverser/RingsRaysApiTest.java  | 42 +++++++++++-----------
 .../api/traverser/SameNeighborsApiTest.java        | 29 ++++++++-------
 23 files changed, 83 insertions(+), 84 deletions(-)

diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java
index 9eb6d24a..1a6282a6 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java
@@ -43,7 +43,7 @@ public class CrosspointsAPI extends TraversersAPI {
     public List<Path> get(Object sourceId, Object targetId,
                           Direction direction, String label,
                           int maxDepth, long degree,
-                          long capacity, long limit) {
+                          long capacity, int limit) {
         String source = GraphAPI.formatVertexId(sourceId, false);
         String target = GraphAPI.formatVertexId(targetId, false);
 
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java
index 493e1bf9..94cf6850 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java
@@ -42,7 +42,7 @@ public class KneighborAPI extends TraversersAPI {
     }
 
     public List<Object> get(Object sourceId, Direction direction,
-                            String label, int depth, long degree, long limit) {
+                            String label, int depth, long degree, int limit) {
         String source = GraphAPI.formatVertexId(sourceId, false);
 
         checkPositive(depth, "Depth of k-neighbor");
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java
index 9e9ca019..9d709b33 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java
@@ -43,7 +43,7 @@ public class KoutAPI extends TraversersAPI {
 
     public List<Object> get(Object sourceId, Direction direction,
                             String label, int depth, boolean nearest,
-                            long degree, long capacity, long limit) {
+                            long degree, long capacity, int limit) {
         String source = GraphAPI.formatVertexId(sourceId, false);
 
         checkPositive(depth, "Depth of k-out");
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java
index 5d351330..9790f434 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java
@@ -45,7 +45,7 @@ public class PathsAPI extends TraversersAPI {
     public List<Path> get(Object sourceId, Object targetId,
                           Direction direction, String label,
                           int maxDepth, long degree, long capacity,
-                          long limit) {
+                          int limit) {
         String source = GraphAPI.formatVertexId(sourceId, false);
         String target = GraphAPI.formatVertexId(targetId, false);
 
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java
index 43112b6f..47b6e8a0 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java
@@ -53,7 +53,7 @@ public class PersonalRankAPI extends TraversersAPI {
         @JsonProperty("max_degree")
         public long degree = Traverser.DEFAULT_MAX_DEGREE;
         @JsonProperty("limit")
-        private long limit = Traverser.DEFAULT_LIMIT;
+        private int limit = Traverser.DEFAULT_LIMIT;
         @JsonProperty("max_depth")
         private int maxDepth = 5;
         @JsonProperty("with_label")
@@ -115,7 +115,7 @@ public class PersonalRankAPI extends TraversersAPI {
                 return this;
             }
 
-            public Builder limit(long limit) {
+            public Builder limit(int limit) {
                 TraversersAPI.checkLimit(limit);
                 this.request.limit = limit;
                 return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java
index a4fd9a4b..8b2af902 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java
@@ -41,7 +41,7 @@ public class RaysAPI extends TraversersAPI {
     }
 
     public List<Path> get(Object sourceId, Direction direction, String label,
-                          int depth, long degree, long capacity, long limit) {
+                          int depth, long degree, long capacity, int limit) {
         String source = GraphAPI.formatVertexId(sourceId, false);
 
         checkPositive(depth, "Max depth of path");
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java
index 03bb1e97..8ad0b64e 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java
@@ -42,7 +42,7 @@ public class RingsAPI extends TraversersAPI {
 
     public List<Path> get(Object sourceId, Direction direction, String label,
                           int depth, boolean sourceInRing, long degree,
-                          long capacity, long limit) {
+                          long capacity, int limit) {
         String source = GraphAPI.formatVertexId(sourceId, false);
 
         checkPositive(depth, "Max depth of path");
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java
index 928f16c8..23ffb450 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java
@@ -43,7 +43,7 @@ public class SameNeighborsAPI extends TraversersAPI {
 
     public List<Object> get(Object vertexId, Object otherId,
                             Direction direction, String label,
-                            long degree, long limit) {
+                            long degree, int limit) {
         this.client.checkApiVersion("0.51", "same neighbors");
         String vertex = GraphAPI.formatVertexId(vertexId, false);
         String other = GraphAPI.formatVertexId(otherId, false);
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java
index 463ae34f..bbd96392 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java
@@ -42,7 +42,7 @@ public class SingleSourceShortestPathAPI extends TraversersAPI {
 
     public WeightedPaths get(Object sourceId, Direction direction, String label,
                              String weight, long degree, long skipDegree,
-                             long capacity, long limit, boolean withVertex) {
+                             long capacity, int limit, boolean withVertex) {
         this.client.checkApiVersion("0.51", "single source shortest path");
         String source = GraphAPI.formatVertexId(sourceId, false);
 
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java
index 93d57351..246e9bbc 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java
@@ -50,7 +50,7 @@ public class TraversersAPI extends API {
         checkLimit(capacity, "Capacity");
     }
 
-    public static void checkLimit(long limit) {
+    public static void checkLimit(int limit) {
         checkLimit(limit, "Limit");
     }
 
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java
index f8ba4dec..7ad4ba4b 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java
@@ -178,7 +178,7 @@ public class TraverserManager {
 
     public List<Object> sameNeighbors(Object vertexId, Object otherId,
                                       Direction direction, String label,
-                                      long degree, long limit) {
+                                      long degree, int limit) {
         return this.sameNeighborsAPI.get(vertexId, otherId, direction,
                                          label, degree, limit);
     }
@@ -272,7 +272,7 @@ public class TraverserManager {
                                                   Direction direction,
                                                   String label, String weight,
                                                   long degree, long skipDegree,
-                                                  long capacity, long limit,
+                                                  long capacity, int limit,
                                                   boolean withVertex) {
         return this.singleSourceShortestPathAPI.get(sourceId, direction, label,
                                                     weight, degree, skipDegree,
@@ -317,21 +317,21 @@ public class TraverserManager {
     }
 
     public List<Path> paths(Object sourceId, Object targetId,
-                            Direction direction, int maxDepth, long limit) {
+                            Direction direction, int maxDepth, int limit) {
         return this.paths(sourceId, targetId, direction, null,
                           maxDepth, limit);
     }
 
     public List<Path> paths(Object sourceId, Object targetId,
                             Direction direction, String label,
-                            int maxDepth, long limit) {
+                            int maxDepth, int limit) {
         return this.paths(sourceId, targetId, direction, label, maxDepth,
                           DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
     }
 
     public List<Path> paths(Object sourceId, Object targetId,
                             Direction direction, String label, int maxDepth,
-                            long degree, long capacity, long limit) {
+                            long degree, long capacity, int limit) {
         return this.pathsAPI.get(sourceId, targetId, direction, label,
                                  maxDepth, degree, capacity, limit);
     }
@@ -348,14 +348,14 @@ public class TraverserManager {
 
     public List<Path> crosspoint(Object sourceId, Object targetId,
                                  Direction direction, int maxDepth,
-                                 long limit) {
+                                 int limit) {
         return this.crosspoint(sourceId, targetId, direction, null,
                                maxDepth, limit);
     }
 
     public List<Path> crosspoint(Object sourceId, Object targetId,
                                  Direction direction, String label,
-                                 int maxDepth, long limit) {
+                                 int maxDepth, int limit) {
         return this.crosspoint(sourceId, targetId, direction, label, maxDepth,
                                DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
     }
@@ -363,7 +363,7 @@ public class TraverserManager {
     public List<Path> crosspoint(Object sourceId, Object targetId,
                                  Direction direction, String label,
                                  int maxDepth, long degree, long capacity,
-                                 long limit) {
+                                 int limit) {
         return this.crosspointsAPI.get(sourceId, targetId, direction, label,
                                        maxDepth, degree, capacity, limit);
     }
@@ -385,7 +385,7 @@ public class TraverserManager {
 
     public List<Object> kout(Object sourceId, Direction direction,
                              String label, int depth, boolean nearest,
-                             long degree, long capacity, long limit) {
+                             long degree, long capacity, int limit) {
         return this.koutAPI.get(sourceId, direction, label, depth, nearest,
                                 degree, capacity, limit);
     }
@@ -411,7 +411,7 @@ public class TraverserManager {
 
     public List<Object> kneighbor(Object sourceId, Direction direction,
                                   String label, int depth,
-                                  long degree, long limit) {
+                                  long degree, int limit) {
         return this.kneighborAPI.get(sourceId, direction, label, depth,
                                      degree, limit);
     }
@@ -432,7 +432,7 @@ public class TraverserManager {
 
     public List<Path> rings(Object sourceId, Direction direction, String label,
                             int depth, boolean sourceInRing, long degree,
-                            long capacity, long limit) {
+                            long capacity, int limit) {
         return this.ringsAPI.get(sourceId, direction, label, depth,
                                  sourceInRing, degree, capacity, limit);
     }
@@ -444,7 +444,7 @@ public class TraverserManager {
     }
 
     public List<Path> rays(Object sourceId, Direction direction, String label,
-                           int depth, long degree, long capacity, long limit) {
+                           int depth, long degree, long capacity, int limit) {
         return this.raysAPI.get(sourceId, direction, label, depth, degree,
                                 capacity, limit);
     }
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/constant/Traverser.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/constant/Traverser.java
index 791e5eec..ab76cbfb 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/constant/Traverser.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/constant/Traverser.java
@@ -22,11 +22,11 @@ package com.baidu.hugegraph.structure.constant;
 public class Traverser {
 
     public static final long DEFAULT_CAPACITY = 10_000_000L;
-    public static final long DEFAULT_LIMIT = 100L;
-    public static final long DEFAULT_ELEMENTS_LIMIT = 10_000_000L;
+    public static final int DEFAULT_LIMIT = 100;
+    public static final int DEFAULT_ELEMENTS_LIMIT = 10_000_000;
     public static final long DEFAULT_MAX_DEGREE = 10_000L;
-    public static final long DEFAULT_CROSSPOINT_LIMIT = 10_000L;
-    public static final long DEFAULT_PATHS_LIMIT = 10L;
+    public static final int DEFAULT_CROSSPOINT_LIMIT = 10_000;
+    public static final int DEFAULT_PATHS_LIMIT = 10;
     public static final long DEFAULT_DEDUP_SIZE = 1_000_000L;
     public static final long DEFAULT_SKIP_DEGREE = 100_000L;
     public static final long DEFAULT_SAMPLE = 100L;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CrosspointsRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CrosspointsRequest.java
index 6e222d44..1a0ce0b7 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CrosspointsRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CrosspointsRequest.java
@@ -39,7 +39,7 @@ public class CrosspointsRequest {
     @JsonProperty("capacity")
     private long capacity;
     @JsonProperty("limit")
-    private long limit;
+    private int limit;
     @JsonProperty("with_path")
     private boolean withPath;
     @JsonProperty("with_vertex")
@@ -95,7 +95,7 @@ public class CrosspointsRequest {
             return this;
         }
 
-        public Builder limit(long limit) {
+        public Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CustomizedPathsRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CustomizedPathsRequest.java
index a4667532..c84d91b6 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CustomizedPathsRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/CustomizedPathsRequest.java
@@ -44,7 +44,7 @@ public class CustomizedPathsRequest {
     @JsonProperty("capacity")
     private long capacity;
     @JsonProperty("limit")
-    private long limit;
+    private int limit;
     @JsonProperty("with_vertex")
     private boolean withVertex;
 
@@ -103,7 +103,7 @@ public class CustomizedPathsRequest {
             return this;
         }
 
-        public Builder limit(long limit) {
+        public Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/FusiformSimilarityRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/FusiformSimilarityRequest.java
index 34981a99..c5c5cb3d 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/FusiformSimilarityRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/FusiformSimilarityRequest.java
@@ -50,7 +50,7 @@ public class FusiformSimilarityRequest {
     @JsonProperty("capacity")
     public long capacity;
     @JsonProperty("limit")
-    public long limit;
+    public int limit;
     @JsonProperty("with_intermediary")
     public boolean withIntermediary;
     @JsonProperty("with_vertex")
@@ -165,7 +165,7 @@ public class FusiformSimilarityRequest {
             return this;
         }
 
-        public Builder limit(long limit) {
+        public Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KneighborRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KneighborRequest.java
index 7907cc52..b179c324 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KneighborRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KneighborRequest.java
@@ -35,7 +35,7 @@ public class KneighborRequest {
     @JsonProperty("count_only")
     public boolean countOnly = false;
     @JsonProperty("limit")
-    public long limit = Traverser.DEFAULT_LIMIT;
+    public int limit = Traverser.DEFAULT_LIMIT;
     @JsonProperty("with_vertex")
     public boolean withVertex = false;
     @JsonProperty("with_path")
@@ -97,7 +97,7 @@ public class KneighborRequest {
             return this;
         }
 
-        public Builder limit(long limit) {
+        public Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KoutRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KoutRequest.java
index 0217a030..305a8d3a 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KoutRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/KoutRequest.java
@@ -39,7 +39,7 @@ public class KoutRequest {
     @JsonProperty("capacity")
     public long capacity = Traverser.DEFAULT_CAPACITY;
     @JsonProperty("limit")
-    public long limit = Traverser.DEFAULT_LIMIT;
+    public int limit = Traverser.DEFAULT_LIMIT;
     @JsonProperty("with_vertex")
     public boolean withVertex = false;
     @JsonProperty("with_path")
@@ -115,7 +115,7 @@ public class KoutRequest {
             return this;
         }
 
-        public Builder limit(long limit) {
+        public Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/PathsRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/PathsRequest.java
index 5b772873..fd9ac986 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/PathsRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/PathsRequest.java
@@ -39,7 +39,7 @@ public class PathsRequest {
     @JsonProperty("capacity")
     public long capacity = Traverser.DEFAULT_CAPACITY;
     @JsonProperty("limit")
-    public long limit = Traverser.DEFAULT_LIMIT;
+    public int limit = Traverser.DEFAULT_LIMIT;
     @JsonProperty("with_vertex")
     public boolean withVertex = false;
 
@@ -102,7 +102,7 @@ public class PathsRequest {
             return this;
         }
 
-        public PathsRequest.Builder limit(long limit) {
+        public PathsRequest.Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/TemplatePathsRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/TemplatePathsRequest.java
index ee24d1ba..a21a7272 100644
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/TemplatePathsRequest.java
+++ b/hugegraph-client/src/main/java/com/baidu/hugegraph/structure/traverser/TemplatePathsRequest.java
@@ -40,7 +40,7 @@ public class TemplatePathsRequest {
     @JsonProperty("capacity")
     public long capacity = Traverser.DEFAULT_CAPACITY;
     @JsonProperty("limit")
-    public long limit = Traverser.DEFAULT_PATHS_LIMIT;
+    public int limit = Traverser.DEFAULT_PATHS_LIMIT;
     @JsonProperty("with_vertex")
     public boolean withVertex = false;
 
@@ -106,7 +106,7 @@ public class TemplatePathsRequest {
             return this;
         }
 
-        public Builder limit(long limit) {
+        public Builder limit(int limit) {
             TraversersAPI.checkLimit(limit);
             this.request.limit = limit;
             return this;
diff --git a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KneighborApiTest.java b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KneighborApiTest.java
index e87aecab..f94caccc 100644
--- a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KneighborApiTest.java
+++ b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KneighborApiTest.java
@@ -55,7 +55,7 @@ public class KneighborApiTest extends TraverserApiTest {
         long softwareId = vertexLabelAPI.get("software").id();
 
         List<Object> vertices = kneighborAPI.get(markoId, Direction.OUT,
-                                                 null, 2, -1L, -1L);
+                                                 null, 2, -1L, -1);
         Assert.assertEquals(4, vertices.size());
         Assert.assertTrue(vertices.contains(softwareId + ":lop"));
         Assert.assertTrue(vertices.contains(softwareId + ":ripple"));
diff --git a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KoutApiTest.java b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KoutApiTest.java
index 3a8cef05..b992e0cd 100644
--- a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KoutApiTest.java
+++ b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/KoutApiTest.java
@@ -55,7 +55,7 @@ public class KoutApiTest extends TraverserApiTest {
         long softwareId = vertexLabelAPI.get("software").id();
 
         List<Object> vertices = koutAPI.get(markoId, Direction.OUT,
-                                            null, 2, true, -1L, -1L, -1L);
+                                            null, 2, true, -1L, -1L, -1);
         Assert.assertEquals(1, vertices.size());
         Assert.assertTrue(vertices.contains(softwareId + ":ripple"));
     }
@@ -67,7 +67,7 @@ public class KoutApiTest extends TraverserApiTest {
         long softwareId = vertexLabelAPI.get("software").id();
 
         List<Object> vertices = koutAPI.get(markoId, Direction.OUT, null,
-                                            2, false, -1L, -1L, -1L);
+                                            2, false, -1L, -1L, -1);
         Assert.assertEquals(2, vertices.size());
         Assert.assertTrue(vertices.contains(softwareId + ":lop"));
         Assert.assertTrue(vertices.contains(softwareId + ":ripple"));
@@ -81,7 +81,7 @@ public class KoutApiTest extends TraverserApiTest {
         long softwareId = vertexLabelAPI.get("software").id();
 
         List<Object> vertices = koutAPI.get(markoId, Direction.BOTH,
-                                            null, 2, true, -1L, -1L, -1L);
+                                            null, 2, true, -1L, -1L, -1);
         Assert.assertEquals(2, vertices.size());
         Assert.assertTrue(vertices.contains(personId + ":peter"));
         Assert.assertTrue(vertices.contains(softwareId + ":ripple"));
@@ -95,7 +95,7 @@ public class KoutApiTest extends TraverserApiTest {
         long softwareId = vertexLabelAPI.get("software").id();
 
         List<Object> vertices = koutAPI.get(markoId, Direction.BOTH, null,
-                                            2, false, -1L, -1L, -1L);
+                                            2, false, -1L, -1L, -1);
         Assert.assertEquals(4, vertices.size());
         Assert.assertTrue(vertices.contains(personId + ":josh"));
         Assert.assertTrue(vertices.contains(personId + ":peter"));
@@ -109,7 +109,7 @@ public class KoutApiTest extends TraverserApiTest {
 
         Assert.assertThrows(ServerException.class, () -> {
             koutAPI.get(markoId, Direction.BOTH, null,
-                        2, false, -1L, 1L, 2L);
+                        2, false, -1L, 1L, 2);
         }, e -> {
             String expect = "Capacity can't be less than limit, " +
                             "but got capacity '1' and limit '2'";
@@ -123,7 +123,7 @@ public class KoutApiTest extends TraverserApiTest {
 
         Assert.assertThrows(ServerException.class, () -> {
             koutAPI.get(markoId, Direction.BOTH, null,
-                    2, false, -1L, 1L, -1L);
+                    2, false, -1L, 1L, -1);
         }, e -> {
             String expect = "Capacity can't be less than limit, " +
                             "but got capacity '1' and limit '-1'";
diff --git a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/RingsRaysApiTest.java b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/RingsRaysApiTest.java
index 90161a67..36d99c11 100644
--- a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/RingsRaysApiTest.java
+++ b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/RingsRaysApiTest.java
@@ -69,7 +69,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
     public void testRings() {
         Object markoId = getVertexId("person", "name", "marko");
         List<Path> paths = ringsAPI.get(markoId, Direction.BOTH, null,
-                                        2, false, -1L, -1L, -1L);
+                                        2, false, -1L, -1L, -1);
         Assert.assertEquals(0, paths.size());
     }
 
@@ -80,7 +80,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Object lopId = getVertexId("software", "name", "lop");
 
         List<Path> paths = ringsAPI.get(markoId, Direction.BOTH, null,
-                                        3, false, -1L, -1L, 1L);
+                                        3, false, -1L, -1L, 1);
         Assert.assertEquals(1, paths.size());
         List<Object> path1 = ImmutableList.of(markoId, joshId, lopId, markoId);
         List<Object> path2 = ImmutableList.of(markoId, lopId, joshId, markoId);
@@ -95,15 +95,15 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Object lopId = getVertexId("software", "name", "lop");
 
         List<Path> paths = ringsAPI.get(markoId, Direction.BOTH, null,
-                                        1, false, -1L, -1L, -1L);
+                                        1, false, -1L, -1L, -1);
         Assert.assertEquals(0, paths.size());
 
         paths = ringsAPI.get(markoId, Direction.BOTH, null,
-                             2, false, -1L, -1L, -1L);
+                             2, false, -1L, -1L, -1);
         Assert.assertEquals(0, paths.size());
 
         paths = ringsAPI.get(markoId, Direction.BOTH, null,
-                             3, false, -1L, -1L, -1L);
+                             3, false, -1L, -1L, -1);
         Assert.assertEquals(1, paths.size());
         List<Object> path1 = ImmutableList.of(markoId, joshId, lopId, markoId);
         List<Object> path2 = ImmutableList.of(markoId, lopId, joshId, markoId);
@@ -117,7 +117,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
 
         Assert.assertThrows(ServerException.class, () -> {
             ringsAPI.get(markoId, Direction.BOTH, null,
-                         2, false, -1L, 1L, -1L);
+                         2, false, -1L, 1L, -1);
         }, e -> {
             String expect = "Exceed capacity '1' while finding rings";
             Assert.assertContains(expect, e.getMessage());
@@ -127,7 +127,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
     @Test
     public void testRingsSourceInRing() {
         List<Path> paths = ringsAPI.get(1, Direction.BOTH, null,
-                                        3, true, -1L, -1L, -1L);
+                                        3, true, -1L, -1L, -1);
         Assert.assertEquals(1, paths.size());
         List<Object> path1 = ImmutableList.of(1, 3, 2, 1);
         List<Object> path2 = ImmutableList.of(1, 2, 3, 1);
@@ -135,13 +135,13 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
 
         paths = ringsAPI.get(2, Direction.OUT, null,
-                             2, true, -1L, -1L, -1L);
+                             2, true, -1L, -1L, -1);
         Assert.assertEquals(1, paths.size());
         List<Object> path3 = ImmutableList.of(2, 3, 2);
         Assert.assertEquals(path3, paths.get(0).objects());
 
         paths = ringsAPI.get(2, Direction.BOTH, null,
-                             2, true, -1L, -1L, -1L);
+                             2, true, -1L, -1L, -1);
         Assert.assertEquals(1, paths.size());
         Assert.assertEquals(path3, paths.get(0).objects());
     }
@@ -149,7 +149,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
     @Test
     public void testRingsWithoutSourceInRing() {
         List<Path> paths = ringsAPI.get(1, Direction.BOTH, null,
-                                        3, false, -1L, -1L, -1L);
+                                        3, false, -1L, -1L, -1);
         Assert.assertEquals(3, paths.size());
         List<Object> path1 = ImmutableList.of(1, 3, 2, 3);
         List<Object> path2 = ImmutableList.of(1, 3, 2, 1);
@@ -162,7 +162,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));
 
         paths = ringsAPI.get(2, Direction.OUT, null,
-                             3, false, -1L, -1L, -1L);
+                             3, false, -1L, -1L, -1);
         Assert.assertEquals(2, paths.size());
         List<Object> path5 = ImmutableList.of(2, 3, 2);
         List<Object> path6 = ImmutableList.of(2, 3, 1, 2);
@@ -171,7 +171,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
 
         paths = ringsAPI.get(2, Direction.BOTH, null,
-                             3, false, -1L, -1L, -1L);
+                             3, false, -1L, -1L, -1);
         Assert.assertEquals(2, paths.size());
         List<Object> path7 = ImmutableList.of(2, 3, 1, 2);
         List<Object> path8 = ImmutableList.of(2, 1, 3, 2);
@@ -189,7 +189,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Object rippleId = getVertexId("software", "name", "ripple");
 
         List<Path> paths = raysAPI.get(markoId, Direction.OUT, null,
-                                       2, -1L, -1L, -1L);
+                                       2, -1L, -1L, -1);
         Assert.assertEquals(4, paths.size());
         List<Object> path1 = ImmutableList.of(markoId, lopId);
         List<Object> path2 = ImmutableList.of(markoId, vadasId);
@@ -210,7 +210,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Object lopId = getVertexId("software", "name", "lop");
 
         List<Path> paths = raysAPI.get(markoId, Direction.OUT, null,
-                                       2, -1L, -1L, 2L);
+                                       2, -1L, -1L, 2);
         Assert.assertEquals(2, paths.size());
         List<Object> path1 = ImmutableList.of(markoId, lopId);
         List<Object> path2 = ImmutableList.of(markoId, vadasId);
@@ -228,7 +228,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Object rippleId = getVertexId("software", "name", "ripple");
 
         List<Path> paths = raysAPI.get(markoId, Direction.OUT, null,
-                                       1, -1L, -1L, -1L);
+                                       1, -1L, -1L, -1);
         Assert.assertEquals(3, paths.size());
         List<Object> path1 = ImmutableList.of(markoId, lopId);
         List<Object> path2 = ImmutableList.of(markoId, vadasId);
@@ -240,7 +240,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));
 
         paths = raysAPI.get(markoId, Direction.OUT, null,
-                            2, -1L, -1L, -1L);
+                            2, -1L, -1L, -1);
         Assert.assertEquals(4, paths.size());
         List<Object> path4 = ImmutableList.of(markoId, joshId, rippleId);
         List<Object> path5 = ImmutableList.of(markoId, joshId, lopId);
@@ -251,7 +251,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(3).objects()));
 
         paths = raysAPI.get(markoId, Direction.OUT, null,
-                            3, -1L, -1L, -1L);
+                            3, -1L, -1L, -1);
         Assert.assertEquals(4, paths.size());
         Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
         Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
@@ -265,7 +265,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
 
         Assert.assertThrows(ServerException.class, () -> {
             raysAPI.get(markoId, Direction.OUT, null,
-                        2, -1L, 1L, -1L);
+                        2, -1L, 1L, -1);
         }, e -> {
             String expect = "Exceed capacity '1' while finding rays";
             Assert.assertContains(expect, e.getMessage());
@@ -282,7 +282,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Object rippleId = getVertexId("software", "name", "ripple");
 
         List<Path> paths = raysAPI.get(markoId, Direction.BOTH, null,
-                                       1, -1L, -1L, -1L);
+                                       1, -1L, -1L, -1);
         Assert.assertEquals(3, paths.size());
         List<Object> path1 = ImmutableList.of(markoId, lopId);
         List<Object> path2 = ImmutableList.of(markoId, vadasId);
@@ -294,7 +294,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));
 
         paths = raysAPI.get(markoId, Direction.BOTH, null,
-                            2, -1L, -1L, -1L);
+                            2, -1L, -1L, -1);
         Assert.assertEquals(5, paths.size());
         List<Object> path4 = ImmutableList.of(markoId, vadasId);
         List<Object> path5 = ImmutableList.of(markoId, lopId, joshId);
@@ -309,7 +309,7 @@ public class RingsRaysApiTest extends TraverserApiTest {
         Assert.assertTrue(expectedPaths.contains(paths.get(4).objects()));
 
         paths = raysAPI.get(markoId, Direction.BOTH, null,
-                            3, -1L, -1L, -1L);
+                            3, -1L, -1L, -1);
         Assert.assertEquals(5, paths.size());
         List<Object> path9 = ImmutableList.of(markoId, vadasId);
         List<Object> path10 = ImmutableList.of(markoId, joshId, rippleId);
diff --git a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/SameNeighborsApiTest.java b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/SameNeighborsApiTest.java
index 248a3048..86d71d3d 100644
--- a/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/SameNeighborsApiTest.java
+++ b/hugegraph-client/src/test/java/com/baidu/hugegraph/api/traverser/SameNeighborsApiTest.java
@@ -78,7 +78,7 @@ public class SameNeighborsApiTest extends TraverserApiTest {
     @Test
     public void testSameNeighbors() {
         List<Object> neighbors = sameNeighborsAPI.get(1, 2, Direction.BOTH,
-                                                      null, -1, -1L);
+                                                      null, -1, -1);
         Assert.assertEquals(4, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(3, 4, 5, 6)));
@@ -87,13 +87,13 @@ public class SameNeighborsApiTest extends TraverserApiTest {
     @Test
     public void testSameNeighborsWithDirection() {
         List<Object> neighbors = sameNeighborsAPI.get(1, 2, Direction.OUT,
-                                                      null, -1, -1L);
+                                                      null, -1, -1);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(3, 5)));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.IN,
-                                         null, -1, -1L);
+                                         null, -1, -1);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(4, 6)));
@@ -102,37 +102,36 @@ public class SameNeighborsApiTest extends TraverserApiTest {
     @Test
     public void testSameNeighborsWithLabel() {
         List<Object> neighbors = sameNeighborsAPI.get(1, 2, Direction.BOTH,
-                                                      "link", -1, -1L);
+                                                      "link", -1, -1);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(3, 4)));
 
-        neighbors = sameNeighborsAPI.get(1, 2, Direction.OUT,
-                                         "link", -1, -1L);
+        neighbors = sameNeighborsAPI.get(1, 2, Direction.OUT, "link", -1, -1);
         Assert.assertEquals(1, neighbors.size());
 
         Assert.assertTrue(neighbors.contains(3));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.IN,
-                                         "link", -1, -1L);
+                                         "link", -1, -1);
         Assert.assertEquals(1, neighbors.size());
 
         Assert.assertTrue(neighbors.contains(4));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.BOTH,
-                                         "relateTo", -1, -1L);
+                                         "relateTo", -1, -1);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(5, 6)));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.OUT,
-                                         "relateTo", -1, -1L);
+                                         "relateTo", -1, -1);
         Assert.assertEquals(1, neighbors.size());
 
         Assert.assertTrue(neighbors.contains(5));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.IN,
-                                         "relateTo", -1, -1L);
+                                         "relateTo", -1, -1);
         Assert.assertEquals(1, neighbors.size());
 
         Assert.assertTrue(neighbors.contains(6));
@@ -141,13 +140,13 @@ public class SameNeighborsApiTest extends TraverserApiTest {
     @Test
     public void testSameNeighborsWithDegree() {
         List<Object> neighbors = sameNeighborsAPI.get(1, 2, Direction.OUT,
-                                                      null, 6, -1L);
+                                                      null, 6, -1);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(3, 5)));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.OUT,
-                                         null, 1, -1L);
+                                         null, 1, -1);
         Assert.assertEquals(1, neighbors.size());
 
         Assert.assertTrue(neighbors.contains(3));
@@ -156,19 +155,19 @@ public class SameNeighborsApiTest extends TraverserApiTest {
     @Test
     public void testSameNeighborsWithLimit() {
         List<Object> neighbors = sameNeighborsAPI.get(1, 2, Direction.BOTH,
-                                                      "link", 6, -1L);
+                                                      "link", 6, -1);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(3, 4)));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.BOTH,
-                                         "link", 6, 2L);
+                                         "link", 6, 2);
         Assert.assertEquals(2, neighbors.size());
 
         Assert.assertTrue(neighbors.containsAll(ImmutableList.of(3, 4)));
 
         neighbors = sameNeighborsAPI.get(1, 2, Direction.BOTH,
-                                         "link", 6, 1L);
+                                         "link", 6, 1);
         Assert.assertEquals(1, neighbors.size());
 
         Assert.assertTrue(neighbors.contains(3));