You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/02/04 00:37:58 UTC

incubator-tinkerpop git commit: on the TEST branch for the clusters -- NullPointerException fix and GraphFilter optimization.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-962-TEST 79bbee911 -> 60dc6a21f


on the TEST branch for the clusters -- NullPointerException fix and GraphFilter optimization.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/60dc6a21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/60dc6a21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/60dc6a21

Branch: refs/heads/TINKERPOP-962-TEST
Commit: 60dc6a21f5d342366a4686e65d433e4704fb228d
Parents: 79bbee9
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Feb 3 16:38:04 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Feb 3 16:38:04 2016 -0700

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/computer/GraphFilter.java |  4 ++--
 .../structure/util/star/StarGraphGryoSerializer.java    |  2 +-
 .../gremlin/process/computer/GraphFilterTest.java       | 12 +++++++++---
 3 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/60dc6a21/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
index cf45f69..458f7fe 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
@@ -62,9 +62,9 @@ public final class GraphFilter implements Cloneable, Serializable {
         if (!TraversalHelper.isLocalStarGraph(edgeFilter.asAdmin()))
             throw GraphComputer.Exceptions.edgeFilterAccessesAdjacentVertices(edgeFilter);
         this.edgeFilter = edgeFilter.asAdmin().clone();
-        if (this.edgeFilter.getEndStep() instanceof RangeGlobalStep && 0 == ((RangeGlobalStep) this.edgeFilter.getEndStep()).getHighRange()) {
+        if (this.edgeFilter.getEndStep() instanceof RangeGlobalStep && 0 == ((RangeGlobalStep) this.edgeFilter.getEndStep()).getHighRange())
             this.allowNoEdges = true;
-        } else if (this.edgeFilter.getStartStep() instanceof VertexStep) {
+        else if (this.edgeFilter.getStartStep() instanceof VertexStep) {
             this.allowedEdgeLabels.clear();
             this.allowedEdgeLabels.addAll(Arrays.asList(((VertexStep) this.edgeFilter.getStartStep()).getEdgeLabels()));
             this.allowedEdgeDirection = ((VertexStep) this.edgeFilter.getStartStep()).getDirection();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/60dc6a21/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
index d3b80d7..ed94358 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
@@ -157,7 +157,7 @@ public final class StarGraphGryoSerializer extends Serializer<StarGraph> {
                             starGraph.starVertex.addOutEdge(edgeLabel, starGraph.addVertex(T.id, adjacentVertexId), T.id, edgeId);
                         else
                             starGraph.starVertex.addInEdge(edgeLabel, starGraph.addVertex(T.id, adjacentVertexId), T.id, edgeId);
-                    } else {
+                    } else if (null != starGraph.edgeProperties) {
                         starGraph.edgeProperties.remove(edgeId);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/60dc6a21/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilterTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilterTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilterTest.java
index 0a09155..b0aa1d3 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilterTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilterTest.java
@@ -38,16 +38,19 @@ public class GraphFilterTest {
     public void shouldHandlePreFilterCorrectly() {
         GraphFilter graphFilter = new GraphFilter();
         graphFilter.setEdgeFilter(__.<Vertex>bothE().limit(0));
-        assertTrue(graphFilter.allowedEdgeLabels.isEmpty());
-        assertEquals(Direction.BOTH, graphFilter.allowedEdgeDirection);
-        assertFalse(graphFilter.allowAllRemainingEdges);
+        assertTrue(graphFilter.allowNoEdges);
         //
         graphFilter = new GraphFilter();
         graphFilter.setEdgeFilter(__.<Vertex>bothE("knows").limit(0));
+        assertTrue(graphFilter.allowNoEdges);
+        //
+        graphFilter = new GraphFilter();
+        graphFilter.setEdgeFilter(__.<Vertex>bothE("knows").select("a"));
         assertEquals(1, graphFilter.allowedEdgeLabels.size());
         assertTrue(graphFilter.allowedEdgeLabels.contains("knows"));
         assertEquals(Direction.BOTH, graphFilter.allowedEdgeDirection);
         assertFalse(graphFilter.allowAllRemainingEdges);
+        assertFalse(graphFilter.allowNoEdges);
         //
         graphFilter = new GraphFilter();
         graphFilter.setEdgeFilter(__.<Vertex>outE("knows", "created"));
@@ -56,6 +59,7 @@ public class GraphFilterTest {
         assertTrue(graphFilter.allowedEdgeLabels.contains("created"));
         assertEquals(Direction.OUT, graphFilter.allowedEdgeDirection);
         assertTrue(graphFilter.allowAllRemainingEdges);
+        assertFalse(graphFilter.allowNoEdges);
         //
         graphFilter = new GraphFilter();
         graphFilter.setEdgeFilter(__.<Vertex>inE("knows", "created", "likes"));
@@ -65,6 +69,7 @@ public class GraphFilterTest {
         assertTrue(graphFilter.allowedEdgeLabels.contains("likes"));
         assertEquals(Direction.IN, graphFilter.allowedEdgeDirection);
         assertTrue(graphFilter.allowAllRemainingEdges);
+        assertFalse(graphFilter.allowNoEdges);
         //
         graphFilter = new GraphFilter();
         graphFilter.setEdgeFilter(__.<Vertex>inE("knows", "created", "likes"));
@@ -74,6 +79,7 @@ public class GraphFilterTest {
         assertTrue(graphFilter.allowedEdgeLabels.contains("likes"));
         assertEquals(Direction.IN, graphFilter.allowedEdgeDirection);
         assertTrue(graphFilter.allowAllRemainingEdges);
+        assertFalse(graphFilter.allowNoEdges);
         //
         graphFilter = new GraphFilter();
         try {