Repository: tinkerpop
Updated Branches:
  refs/heads/master ba38f4ef5 -> ce41db1d2


if the probability of bulking is high at the end step, a barrier(SIZE) is 
inserted.


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

Branch: refs/heads/master
Commit: 7c026acb905b68bddf46f0f6bb8501471e347d67
Parents: 00949d4
Author: Marko A. Rodriguez <okramma...@gmail.com>
Authored: Mon Oct 10 10:50:54 2016 -0600
Committer: Marko A. Rodriguez <okramma...@gmail.com>
Committed: Mon Oct 10 10:50:54 2016 -0600

----------------------------------------------------------------------
 .../strategy/optimization/LazyBarrierStrategy.java    |  4 ++--
 .../optimization/LazyBarrierStrategyTest.java         | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c026acb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
index 176921e..f0398a2 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
@@ -70,7 +70,7 @@ public final class LazyBarrierStrategy extends 
AbstractTraversalStrategy<Travers
 
         boolean foundFlatMap = false;
         boolean labeledPath = false;
-        for (int i = 0; i < traversal.getSteps().size() - 1; i++) {
+        for (int i = 0; i < traversal.getSteps().size(); i++) {
             final Step<?, ?> step = traversal.getSteps().get(i);
 
             if (step instanceof PathProcessor) {
@@ -81,7 +81,7 @@ public final class LazyBarrierStrategy extends 
AbstractTraversalStrategy<Travers
             if (step instanceof FlatMapStep &&
                     !(step instanceof VertexStep && ((VertexStep) 
step).returnsEdge()) ||
                     (step instanceof GraphStep &&
-                            (((GraphStep) step).getIds().length >= 
BIG_START_SIZE ||
+                            (i > 0 || ((GraphStep) step).getIds().length >= 
BIG_START_SIZE ||
                                     (((GraphStep) step).getIds().length == 0 
&& !(step.getNextStep() instanceof HasStep))))) {
                 if (foundFlatMap && !labeledPath && !(step.getNextStep() 
instanceof Barrier)) {
                     final Step noOpBarrierStep = new 
NoOpBarrierStep<>(traversal, MAX_BARRIER_SIZE);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c026acb/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
index f21c64a..f1738e2 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
@@ -85,18 +85,18 @@ public class LazyBarrierStrategyTest {
                 {__.repeat(__.out()).times(4), __.repeat(__.out()).times(4), 
Collections.emptyList()},
                 {__.repeat(__.out()).times(4), 
__.out().barrier(5000).out().barrier(5000).out().barrier(5000).out().barrier(5000),
 Collections.singletonList(RepeatUnrollStrategy.instance())},
                 {__.out().out().as("a").select("a").out(), 
__.out().out().barrier(SIZE).as("a").select("a").out(), 
Collections.emptyList()},
-                {__.out().out().as("a").select("a").out(), 
__.out().out().barrier(SIZE).as("a").select("a").barrier(2500).out(), 
Collections.singletonList(PathRetractionStrategy.instance())},
-                {__.out().out().as("a").out().select("a").out(), 
__.out().out().barrier(SIZE).as("a").out().select("a").barrier(2500).out(), 
Collections.singletonList(PathRetractionStrategy.instance())},
-                {__.out().out().out().limit(10).out(), 
__.out().out().barrier(SIZE).out().limit(10).out(), Collections.emptyList()},
+                {__.out().out().as("a").select("a").out(), 
__.out().out().barrier(SIZE).as("a").select("a").barrier(2500).out().barrier(SIZE),
 Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().out().as("a").out().select("a").out(), 
__.out().out().barrier(SIZE).as("a").out().select("a").barrier(2500).out().barrier(SIZE),
 Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().out().out().limit(10).out(), 
__.out().out().barrier(SIZE).out().limit(10).out().barrier(SIZE), 
Collections.emptyList()},
                 {__.V().out().in().where(P.neq("a")), 
__.V().out().barrier(SIZE).in().barrier(SIZE).where(P.neq("a")), 
Collections.emptyList()},
                 {__.V().as("a").out().in().where(P.neq("a")), 
__.V().as("a").out().in().where(P.neq("a")), Collections.emptyList()},
                 {__.out().out().in().where(P.neq("a")), 
__.out().out().barrier(SIZE).in().barrier(SIZE).where(P.neq("a")), 
Collections.emptyList()},
                 {__.out().as("a").out().in().where(P.neq("a")), 
__.out().as("a").out().in().where(P.neq("a")), Collections.emptyList()},
-                {__.out().as("a").out().in().where(P.neq("a")).out().out(), 
__.out().as("a").out().in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out(),
 Collections.singletonList(PathRetractionStrategy.instance())},
-                
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), 
__.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out(),
 Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().as("a").out().in().where(P.neq("a")).out().out(), 
__.out().as("a").out().in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out().barrier(SIZE),
 Collections.singletonList(PathRetractionStrategy.instance())},
+                
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), 
__.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out().barrier(SIZE),
 Collections.singletonList(PathRetractionStrategy.instance())},
                 
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), 
__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), 
Collections.emptyList()},
-                
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out(), 
__.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out(),
 Collections.singletonList(PathRetractionStrategy.instance())},
-                
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out().out(),
 
__.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out().barrier(SIZE).out(),
 Collections.singletonList(PathRetractionStrategy.instance())},
+                
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out(), 
__.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out().barrier(SIZE),
 Collections.singletonList(PathRetractionStrategy.instance())},
+                
{__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out().out(),
 
__.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out().barrier(SIZE).out().barrier(SIZE),
 Collections.singletonList(PathRetractionStrategy.instance())},
         });
     }
 }

Reply via email to