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/03/01 15:26:49 UTC

[38/50] incubator-tinkerpop git commit: Cleaned up ComputerVerificationStrategy. There are few nick-nacks left to do. Added comments about why particular ComputerVertificationExceptions are thrown so its clear what is and is not legal on OLAP.

Cleaned up ComputerVerificationStrategy. There are few nick-nacks left to do. Added comments about why particular ComputerVertificationExceptions are thrown so its clear what is and is not legal on OLAP.


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

Branch: refs/heads/master
Commit: 76b63c491d4f650bfe2adc77455b528d20a8e24b
Parents: b654c84
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Feb 26 18:51:11 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Feb 26 18:51:11 2016 -0700

----------------------------------------------------------------------
 .../computer/traversal/TraverserExecutor.java   |  4 +-
 .../ComputerVerificationStrategy.java           | 39 +++++++++++---------
 2 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/76b63c49/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
index 65ac37f..f32f602 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
@@ -131,7 +131,9 @@ public final class TraverserExecutor {
         } else if (step instanceof SupplyingBarrierStep) {
             memory.add(step.getId(), true);
             memory.add(TraversalVertexProgram.MUTATED_MEMORY_KEYS, new HashSet<>(Collections.singleton(step.getId())));
-        } else if (step instanceof RangeGlobalStep || step instanceof TailGlobalStep || step instanceof CollectingBarrierStep && !(step instanceof AggregateStep)) {
+        } else if (step instanceof RangeGlobalStep || // TODO: DedupGlobalStep
+                step instanceof TailGlobalStep ||
+                step instanceof CollectingBarrierStep && !(step instanceof AggregateStep)) {
             ((Bypassing) step).setBypass(true);
             final TraverserSet<?> traverserSet = new TraverserSet<>();
             step.forEachRemaining(traverser -> {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/76b63c49/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
index ce67ce3..ce5c331 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
@@ -28,7 +28,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.PathProcessor;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
-import org.apache.tinkerpop.gremlin.process.traversal.step.branch.UnionStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DedupGlobalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTraversalStep;
@@ -42,7 +41,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierS
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.structure.Edge;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -92,22 +90,7 @@ public final class ComputerVerificationStrategy extends AbstractTraversalStrateg
 
         for (final Step<?, ?> step : traversal.getSteps()) {
 
-            if (step instanceof CollectingBarrierStep && step instanceof TraversalParent) {
-                if (((TraversalParent) step).getLocalChildren().stream().filter(t -> !TraversalHelper.isLocalVertex(t)).findAny().isPresent())
-                    throw new VerificationException("A final CollectingBarrierStep can not process the incident edges of a vertex: " + step, traversal);
-                if (!((TraversalParent) step).getLocalChildren().isEmpty() && TraversalHelper.getLastElementClass(traversal).equals(Edge.class))
-                    throw new VerificationException("The final CollectingBarrierStep can not operate on edges or their properties:" + step, traversal);
-            }
-
-            if (step instanceof ReducingBarrierStep && step.getTraversal().getParent() instanceof UnionStep)
-                throw new VerificationException("Reducing barriers within union()-step are not allowed: " + step, traversal);
-
-            if (TraversalHelper.getRootTraversal(traversal).getTraverserRequirements().contains(TraverserRequirement.ONE_BULK))
-                throw new VerificationException("One bulk us currently not supported: " + step, traversal);
-
-            if (step instanceof DedupGlobalStep && (!((DedupGlobalStep) step).getLocalChildren().isEmpty() || !((DedupGlobalStep) step).getScopeKeys().isEmpty()))
-                throw new VerificationException("Global traversals on GraphComputer may not contain by()-projecting de-duplication steps: " + step, traversal);
-
+            // you can not traverser past the local star graph with localChildren (e.g. by()-modulators).
             if (step instanceof TraversalParent) {
                 final Optional<Traversal.Admin<Object, Object>> traversalOptional = ((TraversalParent) step).getLocalChildren().stream()
                         .filter(t -> !TraversalHelper.isLocalStarGraph(t.asAdmin()))
@@ -116,6 +99,26 @@ public final class ComputerVerificationStrategy extends AbstractTraversalStrateg
                     throw new VerificationException("Local traversals on GraphComputer may not traverse past the local star-graph: " + traversalOptional.get(), traversal);
             }
 
+            // collecting barriers and dedup global use can only operate on the element and its properties (no incidences)
+            if ((step instanceof CollectingBarrierStep || step instanceof DedupGlobalStep) && step instanceof TraversalParent) {
+                if (((TraversalParent) step).getLocalChildren().stream().filter(t -> !TraversalHelper.isLocalVertex(t)).findAny().isPresent())
+                    throw new VerificationException("A CollectingBarrierStep can not process the incident edges of a vertex: " + step, traversal);
+            }
+
+            // this is due to how reducing works and can be fixed by generalizing the current simple model
+            // we need to make it so dedup global does its project post reduction (easy to do, just do it)
+            if ((step instanceof DedupGlobalStep) && (!((DedupGlobalStep) step).getScopeKeys().isEmpty() || !((DedupGlobalStep) step).getLocalChildren().isEmpty())) {
+                throw new VerificationException("A dedup()-step can not process scoped elements: " + step, traversal);
+            }
+
+            // this is a problem with global parents and reseting reducers back to their seeds (this is more complicated than just an OLAP issue)
+            if (step instanceof ReducingBarrierStep && !(step.getTraversal().getParent() instanceof TraversalVertexProgramStep || step.getTraversal().getParent() instanceof EmptyStep))
+                throw new VerificationException("Reducing barriers within union()-step are not allowed: " + step, traversal);
+
+            // this is a problem because sideEffect.merge() is transient on the OLAP reduction
+            if (TraversalHelper.getRootTraversal(traversal).getTraverserRequirements().contains(TraverserRequirement.ONE_BULK))
+                throw new VerificationException("One bulk us currently not supported: " + step, traversal);
+
             if ((step instanceof WherePredicateStep && ((WherePredicateStep) step).getStartKey().isPresent()) ||
                     (step instanceof WhereTraversalStep && TraversalHelper.getVariableLocations(((WhereTraversalStep<?>) step).getLocalChildren().get(0)).contains(Scoping.Variable.START)))
                 throw new VerificationException("A where()-step that has a start variable is not allowed because the variable value is retrieved from the path: " + step, traversal);