You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2016/05/26 20:19:42 UTC

incubator-tinkerpop git commit: Forgot to handle `FilterSteps`.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1312 90fe49c66 -> 00ef41479


Forgot to handle `FilterSteps`.


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

Branch: refs/heads/TINKERPOP-1312
Commit: 00ef414795e2c104f00991220b830361b146b0be
Parents: 90fe49c
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu May 26 22:18:25 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu May 26 22:18:25 2016 +0200

----------------------------------------------------------------------
 .../strategy/optimization/RangeByIsCountStrategy.java     | 10 +++++-----
 .../strategy/optimization/RangeByIsCountStrategyTest.java |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/00ef4147/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
index 835a8f9..451d561 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
@@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.IsStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NotStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.RangeGlobalStep;
@@ -95,17 +96,16 @@ public final class RangeByIsCountStrategy extends AbstractTraversalStrategy<Trav
                             final Long highRangeCandidate = ((Number) value).longValue() + highRangeOffset;
                             final boolean update = highRange == null || highRangeCandidate > highRange;
                             if (update) {
-                                final boolean isNested = !(parent instanceof EmptyStep);
-                                if (isNested) {
+                                if (parent instanceof EmptyStep) {
+                                    useNotStep = true;
+                                } else {
                                     if (parent instanceof RepeatStep) {
                                         final RepeatStep repeatStep = (RepeatStep) parent;
                                         useNotStep = Objects.equals(traversal, repeatStep.getUntilTraversal())
                                                 || Objects.equals(traversal, repeatStep.getEmitTraversal());
                                     } else {
-                                        useNotStep = parent instanceof SideEffectStep;
+                                        useNotStep = parent instanceof FilterStep || parent instanceof SideEffectStep;
                                     }
-                                } else {
-                                    useNotStep = true;
                                 }
                                 highRange = highRangeCandidate;
                                 useNotStep &= curr.getLabels().isEmpty() && next.getLabels().isEmpty()

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/00ef4147/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
index 8b42e7f..03d5176 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
@@ -142,6 +142,7 @@ public class RangeByIsCountStrategyTest {
                     {__.out().count().is(without(2, 6, 4)), __.out().limit(6).count().is(without(2, 6, 4))},
                     {__.map(__.count().is(0)), __.map(__.limit(1).count().is(0))},
                     {__.flatMap(__.count().is(0)), __.flatMap(__.limit(1).count().is(0))},
+                    {__.filter(__.count().is(0)), __.filter(__.not(__.identity()))},
                     {__.sideEffect(__.count().is(0)), __.sideEffect(__.not(__.identity()))},
                     {__.branch(__.count().is(0)), __.branch(__.limit(1).count().is(0))},
                     {__.count().is(0).store("x"), __.limit(1).count().is(0).store("x")},