tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject tinkerpop git commit: more tests to MatchPredicateStrategyTest -- as()-pullouts on where()-inserts works.
Date Tue, 27 Sep 2016 14:57:16 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1456 7f65a723d -> bf14ef708


more tests to MatchPredicateStrategyTest -- as()-pullouts on where()-inserts works.


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

Branch: refs/heads/TINKERPOP-1456
Commit: bf14ef708ca0c7d992e56db57352e5159c97afda
Parents: 7f65a72
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Tue Sep 27 08:57:04 2016 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Tue Sep 27 08:57:04 2016 -0600

----------------------------------------------------------------------
 .../strategy/optimization/MatchPredicateStrategy.java          | 6 +++++-
 .../strategy/optimization/MatchPredicateStrategyTest.java      | 6 ++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bf14ef70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategy.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategy.java
index a93dcd9..28e5677 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategy.java
@@ -21,6 +21,8 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 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.GraphTraversal;
 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;
@@ -72,7 +74,9 @@ public final class MatchPredicateStrategy extends AbstractTraversalStrategy<Trav
                     (nextStep instanceof SelectOneStep && ((SelectOneStep) nextStep).getLocalChildren().isEmpty()))
{
                 if (nextStep instanceof WherePredicateStep || nextStep instanceof WhereTraversalStep)
{
                     traversal.removeStep(nextStep);
-                    matchStep.addGlobalChild(new DefaultTraversal<>().addStep(nextStep));
+                    matchStep.addGlobalChild(traversal instanceof GraphTraversal ?
+                            new DefaultGraphTraversal<>().addStep(nextStep) :
+                            new DefaultTraversal<>().addStep(nextStep));
                     nextStep = matchStep.getNextStep();
                 } else if (nextStep instanceof DedupGlobalStep && !((DedupGlobalStep)
nextStep).getScopeKeys().isEmpty() && ((DedupGlobalStep) nextStep).getLocalChildren().isEmpty()
&& !TraversalHelper.onGraphComputer(traversal)) {
                     traversal.removeStep(nextStep);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bf14ef70/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategyTest.java
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategyTest.java
index 509004c..8037bd6 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/MatchPredicateStrategyTest.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -33,6 +34,7 @@ import java.util.Collection;
 import java.util.Collections;
 
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.as;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.has;
 import static org.junit.Assert.assertEquals;
 
 /**
@@ -75,8 +77,8 @@ public class MatchPredicateStrategyTest {
                 {__.match(as("a").out().as("b"), __.where(as("b").out("knows").as("c"))),
__.match(as("a").out().as("b"), as("b").where(__.out("knows").as("c"))), Collections.emptyList()},
// make as().where()
                 {__.match(as("a").out().as("b"), __.where("a", P.gt("b"))), __.match(as("a").out().as("b"),
__.as("a").where(P.gt("b"))), Collections.emptyList()},  // make as().where()
                 /////////
-                // {__.match(as("a").out().as("b")).where(as("b").out("knows").as("c")),
__.match(as("a").out().as("b"), as("b").where(__.out("knows").as("c"))), Collections.emptyList()},
// make as().where()
-                // {__.match(as("a").out().as("b")).where("a", P.gt("b")), __.match(as("a").out().as("b"),
__.as("a").where(P.gt("b"))), Collections.emptyList()},  // make as().where()
+                {__.match(as("a").out().as("b")).where(as("b").filter(has("name")).out("knows").as("c")),
__.match(as("a").out().as("b"), as("b").where(has("name").out("knows").as("c"))), Collections.singletonList(InlineFilterStrategy.instance())},
// make as().where()
+                {__.match(as("a").out().as("b")).where("a", P.gt("b")), __.match(as("a").out().as("b"),
as("a").where(P.gt("b"))), Collections.emptyList()},  // make as().where()
         });
     }
 


Mime
View raw message