found a bug in TraversalVertexProgramStep where it was not respecting the 
traversals registered strategies.


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

Branch: refs/heads/TINKERPOP-1278
Commit: ba37407dca9970679c31d0cbd6bd9f13ebd57cc3
Parents: f9c6ea6
Author: Marko A. Rodriguez <okramma...@gmail.com>
Authored: Fri Jul 8 13:13:14 2016 -0600
Committer: Marko A. Rodriguez <okramma...@gmail.com>
Committed: Fri Jul 8 13:13:14 2016 -0600

----------------------------------------------------------------------
 .../traversal/step/map/TraversalVertexProgramStep.java    | 10 ++++++++--
 .../strategy/optimization/PrunePathStrategy.java          |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ba37407d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/TraversalVertexProgramStep.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/TraversalVertexProgramStep.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/TraversalVertexProgramStep.java
index 0eee43a..cb7db29 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/TraversalVertexProgramStep.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/TraversalVertexProgramStep.java
@@ -26,6 +26,7 @@ import 
org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSi
 import 
org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
@@ -66,8 +67,13 @@ public final class TraversalVertexProgramStep extends 
VertexProgramStep implemen
     @Override
     public TraversalVertexProgram generateProgram(final Graph graph, final 
Memory memory) {
         final Traversal.Admin<?, ?> computerSpecificTraversal = 
this.computerTraversal.getPure();
-        
computerSpecificTraversal.setStrategies(TraversalStrategies.GlobalCache.getStrategies(graph.getClass()).clone());
-        
this.getTraversal().getStrategies().toList().forEach(computerSpecificTraversal.getStrategies()::addStrategies);
+        final TraversalStrategies computerSpecificStrategies = 
this.getTraversal().getStrategies().clone();
+        TraversalStrategies.GlobalCache.getStrategies(graph.getClass())
+                .toList()
+                .stream()
+                .filter(s -> s instanceof 
TraversalStrategy.ProviderOptimizationStrategy)
+                .forEach(computerSpecificStrategies::addStrategies);
+        computerSpecificTraversal.setStrategies(computerSpecificStrategies);
         computerSpecificTraversal.setSideEffects(new 
MemoryTraversalSideEffects(this.getTraversal().getSideEffects()));
         computerSpecificTraversal.setParent(this);
         final TraversalVertexProgram.Builder builder = 
TraversalVertexProgram.build().traversal(computerSpecificTraversal);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ba37407d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategy.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategy.java
index e3d50bf..ff56c96 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategy.java
@@ -144,7 +144,7 @@ public final class PrunePathStrategy extends 
AbstractTraversalStrategy<Traversal
                 if (currentStep instanceof PathProcessor)
                     ((PathProcessor) currentStep).setKeepLabels(new 
HashSet<>(keepLabels));
             } else {
-                // if there is a PATh requiring step in the traversal, do not 
drop labels
+                // if there is a PATH requiring step in the traversal, do not 
drop labels
                 // set keep labels to null so that no labels are dropped
                 if (currentStep instanceof PathProcessor)
                     ((PathProcessor) currentStep).setKeepLabels(null);

Reply via email to