tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [12/18] incubator-tinkerpop git commit: SparkCountInterceptor is now called SparkStarBarrierInterceptor and works with count(), max(), sum(), min(), and mean(). groupCount(), group(), and tree() are still left to do.
Date Fri, 06 May 2016 16:09:06 GMT
SparkCountInterceptor is now called SparkStarBarrierInterceptor and works with count(), max(),
sum(), min(), and mean(). groupCount(), group(), and tree() are still left to do.


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

Branch: refs/heads/master
Commit: 6a256f8fcbe6a87a8d794466a7b559ff9ba8d2d6
Parents: 01fda96
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Wed May 4 15:45:27 2016 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Wed May 4 15:45:27 2016 -0600

----------------------------------------------------------------------
 .../step/sideEffect/SackValueStep.java          |   1 -
 .../optimization/SparkInterceptorStrategy.java  |   6 +-
 .../interceptor/SparkCountInterceptor.java      | 103 --------------
 .../SparkStarBarrierInterceptor.java            | 142 +++++++++++++++++++
 .../SparkInterceptorStrategyTest.java           |  47 +++---
 5 files changed, 171 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6a256f8f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SackValueStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SackValueStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SackValueStep.java
index 1b02fe2..7f030d6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SackValueStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SackValueStep.java
@@ -58,7 +58,6 @@ public final class SackValueStep<S, A, B> extends SideEffectStep<S>
implements T
     @Override
     protected void sideEffect(final Traverser.Admin<S> traverser) {
         traverser.sack(this.sackFunction.apply(traverser.sack(), null == this.sackTraversal
? (B) traverser.get() : TraversalUtil.apply(traverser, this.sackTraversal)));
-
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6a256f8f/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategy.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategy.java
b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategy.java
index 89b831d..11c03f7 100644
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategy.java
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategy.java
@@ -25,7 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.optimization.interceptor.SparkCountInterceptor;
+import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.optimization.interceptor.SparkStarBarrierInterceptor;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 
@@ -49,8 +49,8 @@ public final class SparkInterceptorStrategy extends AbstractTraversalStrategy<Tr
             final Traversal.Admin<?, ?> computerTraversal = step.generateProgram(graph).getTraversal().get().clone();
             if (!computerTraversal.isLocked())
                 computerTraversal.applyStrategies();
-            if (SparkCountInterceptor.isLegal(computerTraversal))
-                step.setComputer(step.getComputer().configure(Constants.GREMLIN_HADOOP_VERTEX_PROGRAM_INTERCEPTOR,
SparkCountInterceptor.class.getCanonicalName()));
+            if (SparkStarBarrierInterceptor.isLegal(computerTraversal))
+                step.setComputer(step.getComputer().configure(Constants.GREMLIN_HADOOP_VERTEX_PROGRAM_INTERCEPTOR,
SparkStarBarrierInterceptor.class.getCanonicalName()));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6a256f8f/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkCountInterceptor.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkCountInterceptor.java
b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkCountInterceptor.java
deleted file mode 100644
index f85d6db..0000000
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkCountInterceptor.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.optimization.interceptor;
-
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
-import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DedupGlobalStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountGlobalStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.CollectingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.spark.process.computer.SparkMemory;
-import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.SparkVertexProgramInterceptor;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class SparkCountInterceptor implements SparkVertexProgramInterceptor<TraversalVertexProgram>
{
-
-    public SparkCountInterceptor() {
-
-    }
-
-    @Override
-    public JavaPairRDD<Object, VertexWritable> apply(final TraversalVertexProgram vertexProgram,
final JavaPairRDD<Object, VertexWritable> inputRDD, final SparkMemory memory) {
-        vertexProgram.setup(memory);
-        final Traversal.Admin<Vertex, Long> traversal = (Traversal.Admin) vertexProgram.getTraversal().getPure().clone();
-        final Object[] graphStepIds = ((GraphStep) traversal.getStartStep()).getIds();  
 // any V(1,2,3)-style ids to filter on
-        final CountGlobalStep countGlobalStep = (CountGlobalStep) traversal.getEndStep();
// needed for the final traverser generation
-        traversal.removeStep(0);                                    // remove GraphStep
-        traversal.removeStep(traversal.getSteps().size() - 1);      // remove CountGlobalStep
-        traversal.applyStrategies();                                // compile
-        boolean identityTraversal = traversal.getSteps().isEmpty(); // if the traversal is
empty, just return the vertex (fast)
-
-        ((MemoryTraversalSideEffects) traversal.getSideEffects()).setMemory(memory, true);
// any intermediate sideEffect steps are backed by SparkMemory
-        memory.setInExecute(true);
-        final long count = inputRDD
-                .filter(tuple -> ElementHelper.idExists(tuple._2().get().id(), graphStepIds))
-                .flatMapValues(vertexWritable -> {
-                    if (identityTraversal)                          // g.V.count()-style
(identity)
-                        return () -> (Iterator) IteratorUtils.of(vertexWritable);
-                    else {                                          // add the vertex to
head of the traversal
-                        return () -> {                              // and iterate it
for its results
-                            final Traversal.Admin<Vertex, ?> clone = traversal.clone();
// need a unique clone for each vertex to isolate the computation
-                            clone.getStartStep().addStart(clone.getTraverserGenerator().generate(vertexWritable.get(),
EmptyStep.instance(), 1l));
-                            return clone;
-                        };
-                    }
-                }).count();
-        memory.setInExecute(false);
-
-        // generate the HALTED_TRAVERSERS for the memory
-        final TraverserSet<Long> haltedTraversers = new TraverserSet<>();
-        haltedTraversers.add(traversal.getTraverserGenerator().generate(count, countGlobalStep,
1l));
-        memory.set(TraversalVertexProgram.HALTED_TRAVERSERS, haltedTraversers);
-        memory.incrIteration(); // any local star graph reduction take a single iteration
-        return inputRDD;
-    }
-
-    public static boolean isLegal(final Traversal.Admin<?, ?> traversal) {
-        final List<Step> steps = traversal.getSteps();
-        if (!steps.get(0).getClass().equals(GraphStep.class) || ((GraphStep) steps.get(0)).returnsEdge())
-            return false;
-        if (!steps.get(steps.size() - 1).getClass().equals(CountGlobalStep.class))
-            return false;
-        if (TraversalHelper.hasStepOfAssignableClassRecursively(Scope.global, Arrays.asList(CollectingBarrierStep.class,
DedupGlobalStep.class), traversal))
-            return false;
-        return TraversalHelper.isLocalStarGraph(traversal);
-
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6a256f8f/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java
b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java
new file mode 100644
index 0000000..3649c8f
--- /dev/null
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.optimization.interceptor;
+
+import org.apache.spark.api.java.JavaPairRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
+import org.apache.tinkerpop.gremlin.process.traversal.NumberHelper;
+import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountGlobalStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MaxGlobalStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MeanGlobalStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MinGlobalStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.SumGlobalStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.spark.process.computer.SparkMemory;
+import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.SparkVertexProgramInterceptor;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.Iterator;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class SparkStarBarrierInterceptor implements SparkVertexProgramInterceptor<TraversalVertexProgram>
{
+
+    public SparkStarBarrierInterceptor() {
+
+    }
+
+    @Override
+    public JavaPairRDD<Object, VertexWritable> apply(final TraversalVertexProgram vertexProgram,
final JavaPairRDD<Object, VertexWritable> inputRDD, final SparkMemory memory) {
+        vertexProgram.setup(memory);
+        final Traversal.Admin<Vertex, Object> traversal = (Traversal.Admin) vertexProgram.getTraversal().getPure().clone();
+        final Object[] graphStepIds = ((GraphStep) traversal.getStartStep()).getIds();  
 // any V(1,2,3)-style ids to filter on
+        final ReducingBarrierStep endStep = (ReducingBarrierStep) traversal.getEndStep();
// needed for the final traverser generation
+        final Traversal.Admin<Object, Object> endStepTraversal = new DefaultTraversal<>();
+        endStepTraversal.addStep(endStep).applyStrategies();
+        traversal.removeStep(0);                                    // remove GraphStep
+        traversal.removeStep(traversal.getSteps().size() - 1);      // remove CountGlobalStep
+        traversal.applyStrategies();                                // compile
+        boolean identityTraversal = traversal.getSteps().isEmpty(); // if the traversal is
empty, just return the vertex (fast)
+        ///////////////////////////////
+        ((MemoryTraversalSideEffects) traversal.getSideEffects()).setMemory(memory, true);
// any intermediate sideEffect steps are backed by SparkMemory
+        memory.setInExecute(true);
+        final JavaRDD<Traverser.Admin<Object>> nextRDD = inputRDD.values()
+                .filter(vertexWritable -> ElementHelper.idExists(vertexWritable.get().id(),
graphStepIds))
+                .flatMap(vertexWritable -> {
+                    if (identityTraversal)                          // g.V.count()-style
(identity)
+                        return () -> IteratorUtils.of(traversal.getTraverserGenerator().generate(vertexWritable.get(),
EmptyStep.instance(), 1l));
+                    else {                                          // add the vertex to
head of the traversal
+                        return () -> {                              // and iterate it
for its results
+                            final Traversal.Admin<Vertex, ?> clone = traversal.clone();
// need a unique clone for each vertex to isolate the computation
+                            clone.getStartStep().addStart(clone.getTraverserGenerator().generate(vertexWritable.get(),
EmptyStep.instance(), 1l));
+                            return (Step) clone.getEndStep();
+                        };
+                    }
+                });
+        final Object result;
+        if (endStep instanceof CountGlobalStep)
+            result = nextRDD.map(Traverser::bulk).fold(0l, (a, b) -> a + b);
+        else if (endStep instanceof SumGlobalStep)
+            result = nextRDD
+                    .map(traverser -> NumberHelper.mul(traverser.bulk(), (Number) traverser.get()))
+                    .fold(0, NumberHelper::add);
+        else if (endStep instanceof MeanGlobalStep)
+            result = nextRDD
+                    .map(traverser -> new MeanGlobalStep.MeanNumber((Number) traverser.get(),
traverser.bulk()))
+                    .fold(new MeanGlobalStep.MeanNumber(), MeanGlobalStep.MeanNumber::add)
+                    .getFinal();
+        else if (endStep instanceof MinGlobalStep)
+            result = nextRDD
+                    .map(traverser -> (Number) traverser.get())
+                    .fold(Integer.MAX_VALUE, NumberHelper::min);
+        else if (endStep instanceof MaxGlobalStep)
+            result = nextRDD
+                    .map(traverser -> (Number) traverser.get())
+                    .fold(Integer.MIN_VALUE, NumberHelper::max);
+        else
+            throw new IllegalArgumentException("The end step is an unsupported barrier: "
+ endStep);
+        memory.setInExecute(false);
+        ///////////////////////////////
+
+        // generate the HALTED_TRAVERSERS for the memory
+        final TraverserSet<Long> haltedTraversers = new TraverserSet<>();
+        haltedTraversers.add(traversal.getTraverserGenerator().generate(result, endStep,
1l));
+        memory.set(TraversalVertexProgram.HALTED_TRAVERSERS, haltedTraversers);
+        memory.incrIteration(); // any local star graph reduction take a single iteration
+        return inputRDD;
+    }
+
+    public static boolean isLegal(final Traversal.Admin<?, ?> traversal) {
+        final Step<?, ?> startStep = traversal.getStartStep();
+        final Step<?, ?> endStep = traversal.getEndStep();
+        if (!startStep.getClass().equals(GraphStep.class) || ((GraphStep) startStep).returnsEdge())
+            return false;
+        if (!endStep.getClass().equals(CountGlobalStep.class) &&
+                !endStep.getClass().equals(SumGlobalStep.class) &&
+                !endStep.getClass().equals(MeanGlobalStep.class) &&
+                !endStep.getClass().equals(MaxGlobalStep.class) &&
+                !endStep.getClass().equals(MinGlobalStep.class))
+            // TODO: group(), groupCount(), fold(), and tree()
+            return false;
+        if (TraversalHelper.getStepsOfAssignableClassRecursively(Scope.global, Barrier.class,
traversal).size() != 1)
+            return false;
+        if (traversal.getTraverserRequirements().contains(TraverserRequirement.SACK))
+            return false;
+        return TraversalHelper.isLocalStarGraph(traversal);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6a256f8f/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategyTest.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategyTest.java
b/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategyTest.java
index 4529fd3..f18a944 100644
--- a/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategyTest.java
+++ b/spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/SparkInterceptorStrategyTest.java
@@ -33,7 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 import org.apache.tinkerpop.gremlin.spark.AbstractSparkTest;
 import org.apache.tinkerpop.gremlin.spark.process.computer.SparkGraphComputer;
 import org.apache.tinkerpop.gremlin.spark.process.computer.SparkHadoopGraphProvider;
-import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.optimization.interceptor.SparkCountInterceptor;
+import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.optimization.interceptor.SparkStarBarrierInterceptor;
 import org.apache.tinkerpop.gremlin.spark.structure.io.PersistedOutputRDD;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
@@ -69,7 +69,7 @@ public class SparkInterceptorStrategyTest extends AbstractSparkTest {
         assertTrue(g.V().count().explain().toString().contains(SparkInterceptorStrategy.class.getSimpleName()));
         /// groupCount(m)-test
         Traversal.Admin<Vertex, Long> traversal = g.V().groupCount("m").by(T.label).count().asAdmin();
-        test(SparkCountInterceptor.class, 6l, traversal);
+        test(SparkStarBarrierInterceptor.class, 6l, traversal);
         assertEquals(1, traversal.getSideEffects().keys().size());
         assertTrue(traversal.getSideEffects().exists("m"));
         assertTrue(traversal.getSideEffects().keys().contains("m"));
@@ -94,25 +94,29 @@ public class SparkInterceptorStrategyTest extends AbstractSparkTest {
         assertTrue(g.getStrategies().toList().contains(SparkInterceptorStrategy.instance()));
         assertTrue(g.V().count().explain().toString().contains(SparkInterceptorStrategy.class.getSimpleName()));
         /// SparkCountInterceptor matches
-        test(SparkCountInterceptor.class, 6l, g.V().count());
-        test(SparkCountInterceptor.class, 2l, g.V().hasLabel("software").count());
-        test(SparkCountInterceptor.class, 2l, g.V().hasLabel("person").has("age", P.gt(30)).count());
-        test(SparkCountInterceptor.class, 2l, g.V().hasLabel("person").has("age", P.gt(30)).values("name").count());
-        test(SparkCountInterceptor.class, 2l, g.V().hasLabel("person").has("age", P.gt(30)).properties("name").count());
-        test(SparkCountInterceptor.class, 4l, g.V().hasLabel("person").has("age", P.gt(30)).properties("name",
"age").count());
-        test(SparkCountInterceptor.class, 3l, g.V().hasLabel("person").has("age", P.gt(30)).out().count());
-        test(SparkCountInterceptor.class, 0l, g.V().hasLabel("person").has("age", P.gt(30)).out("knows").count());
-        test(SparkCountInterceptor.class, 3l, g.V().has(T.label, P.not(P.within("robot",
"android")).and(P.within("person", "software"))).hasLabel("person").has("age", P.gt(30)).out("created").count());
-        test(SparkCountInterceptor.class, 3l, g.V(1).out().count());
-        test(SparkCountInterceptor.class, 2l, g.V(1).out("knows").count());
-        test(SparkCountInterceptor.class, 3l, g.V(1).out("knows", "created").count());
-        test(SparkCountInterceptor.class, 5l, g.V(1, 4).out("knows", "created").count());
-        test(SparkCountInterceptor.class, 1l, g.V(2).in("knows").count());
-        test(SparkCountInterceptor.class, 0l, g.V(6).has("name", "peter").in().count());
-        test(SparkCountInterceptor.class, 6l, g.V().as("a").values("name").as("b").count());
-        test(SparkCountInterceptor.class, 6l, g.V().as("a").count());
-        test(SparkCountInterceptor.class, 1l, g.V().has("name", "marko").as("a").values("name").as("b").count());
-        test(SparkCountInterceptor.class, 4l, g.V().has(T.label, P.not(P.within("robot",
"android")).and(P.within("person", "software"))).hasLabel("person").has("age").out("created").count());
+        test(SparkStarBarrierInterceptor.class, 6l, g.V().count());
+        test(SparkStarBarrierInterceptor.class, 2l, g.V().hasLabel("software").count());
+        test(SparkStarBarrierInterceptor.class, 2l, g.V().hasLabel("person").has("age", P.gt(30)).count());
+        test(SparkStarBarrierInterceptor.class, 2l, g.V().hasLabel("person").has("age", P.gt(30)).values("name").count());
+        test(SparkStarBarrierInterceptor.class, 2l, g.V().hasLabel("person").has("age", P.gt(30)).properties("name").count());
+        test(SparkStarBarrierInterceptor.class, 4l, g.V().hasLabel("person").has("age", P.gt(30)).properties("name",
"age").count());
+        test(SparkStarBarrierInterceptor.class, 3l, g.V().hasLabel("person").has("age", P.gt(30)).out().count());
+        test(SparkStarBarrierInterceptor.class, 0l, g.V().hasLabel("person").has("age", P.gt(30)).out("knows").count());
+        test(SparkStarBarrierInterceptor.class, 3l, g.V().has(T.label, P.not(P.within("robot",
"android")).and(P.within("person", "software"))).hasLabel("person").has("age", P.gt(30)).out("created").count());
+        test(SparkStarBarrierInterceptor.class, 3l, g.V(1).out().count());
+        test(SparkStarBarrierInterceptor.class, 2l, g.V(1).out("knows").count());
+        test(SparkStarBarrierInterceptor.class, 3l, g.V(1).out("knows", "created").count());
+        test(SparkStarBarrierInterceptor.class, 5l, g.V(1, 4).out("knows", "created").count());
+        test(SparkStarBarrierInterceptor.class, 1l, g.V(2).in("knows").count());
+        test(SparkStarBarrierInterceptor.class, 0l, g.V(6).has("name", "peter").in().count());
+        test(SparkStarBarrierInterceptor.class, 6l, g.V().as("a").values("name").as("b").count());
+        test(SparkStarBarrierInterceptor.class, 6l, g.V().as("a").count());
+        test(SparkStarBarrierInterceptor.class, 1l, g.V().has("name", "marko").as("a").values("name").as("b").count());
+        test(SparkStarBarrierInterceptor.class, 4l, g.V().has(T.label, P.not(P.within("robot",
"android")).and(P.within("person", "software"))).hasLabel("person").has("age").out("created").count());
+        test(SparkStarBarrierInterceptor.class, 123l, g.V().has("age").values("age").sum());
+        test(SparkStarBarrierInterceptor.class, 67l, g.V().has("age").has("age", P.gt(30)).values("age").sum());
+        test(SparkStarBarrierInterceptor.class, 27, g.V().hasLabel("person").values("age").min());
+        test(SparkStarBarrierInterceptor.class, 35, g.V().hasLabel("person").values("age").max());
         /// No interceptor matches
         test(2l, g.V().out().out().count());
         test(6l, g.E().count());
@@ -123,6 +127,7 @@ public class SparkInterceptorStrategyTest extends AbstractSparkTest {
         test(6l, g.V().repeat(__.dedup()).times(2).count());
         test(6l, g.V().dedup().count());
         test(4l, g.V().hasLabel("person").order().by("age").count());
+        test(1l, g.V().count().count());
     }
 
     private static <R> void test(Class<? extends VertexProgramInterceptor> expectedInterceptor,
R expectedResult, final Traversal<?, R> traversal) throws Exception {


Mime
View raw message