dah. my last tweak made a buggy. now I'm done for the day.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b2f2a9d6 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b2f2a9d6 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b2f2a9d6 Branch: refs/heads/TINKERPOP-1602 Commit: b2f2a9d692392b6eac672c109128ffcb45345150 Parents: 9dee11d Author: Marko A. Rodriguez <okramma...@gmail.com> Authored: Thu Jan 26 15:18:31 2017 -0700 Committer: Marko A. Rodriguez <okramma...@gmail.com> Committed: Fri Jan 27 14:24:18 2017 -0700 ---------------------------------------------------------------------- .../strategy/optimization/SingleIterationStrategy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b2f2a9d6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/SingleIterationStrategy.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/SingleIterationStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/SingleIterationStrategy.java index eed1104..96a2a0a 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/SingleIterationStrategy.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/SingleIterationStrategy.java @@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier; +import org.apache.tinkerpop.gremlin.process.traversal.step.LambdaHolder; import org.apache.tinkerpop.gremlin.process.traversal.step.SideEffectCapable; import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent; import org.apache.tinkerpop.gremlin.process.traversal.step.branch.LocalStep; @@ -93,13 +94,14 @@ public final class SingleIterationStrategy extends AbstractTraversalStrategy<Tra } if (doesMessagePass && // if the traversal doesn't message pass, then don't try and localize it as its just wasted computation TraversalHelper.isLocalStarGraph(computerTraversal) && // if we move beyond the star graph, then localization is not possible. - (computerTraversal.getStartStep() instanceof GraphStep) && // while GraphComputer requires GraphStep starts, this is just a precaution when inject() starts are supported + computerTraversal.getStartStep() instanceof GraphStep && // while GraphComputer requires GraphStep starts, this is just a precaution when inject() starts are supported !(computerTraversal.getStartStep().getNextStep() instanceof EmptyStep) && // if its just a g.V()/E(), then don't localize !(computerTraversal.getStartStep().getNextStep() instanceof LocalStep) && // removes the potential for the infinite recursive application of the traversal !(computerTraversal.getStartStep().getNextStep() instanceof Barrier) && // if the second step is a barrier, no point in trying to localize anything !computerTraversal.getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH) && // this is to alleviate issues with DetachedElement in paths (TODO: when detachment is dynamic, remove this) !computerTraversal.getTraverserRequirements().contains(TraverserRequirement.PATH) && // this is to alleviate issues with DetachedElement in paths (TODO: when detachment is dynamic, remove this) - TraversalHelper.getStepsOfAssignableClassRecursively(SideEffectCapable.class, computerTraversal).isEmpty() && // this is to alleviate issues with DetachedElement in paths (TODO: when detachment is dynamic, remove this) + !TraversalHelper.hasStepOfAssignableClassRecursively(LambdaHolder.class, computerTraversal) && // this is because we might be accessing data on an adjacent vertex and that is bad + !TraversalHelper.hasStepOfAssignableClassRecursively(SideEffectCapable.class, computerTraversal) && // this is to alleviate issues with DetachedElement in paths (TODO: when detachment is dynamic, remove this) !(TraversalHelper.getStepsOfAssignableClass(TraversalParent.class, computerTraversal). // this is a strict precaution that could be loosed with deeper logic on barriers in global children stream(). filter(parent -> !parent.getGlobalChildren().isEmpty()).findAny().isPresent())) {