From 6dfc2d4532a6991f89475bee6d6b217bd195eaa2 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 13 Jun 2022 23:38:52 +0800 Subject: [PATCH] fix: Traversal.graph is empty in StepStrategy.apply() with `count().is(0)` This PR fix: traversal.getGraph() is empty in StepStrategy.apply() method `VertexStepStrategy.apply(Traversal.Admin traversal)` for the following gremlin: ``` g.V(3).repeat(inE('child').outV().simplePath()) .until(or(inE().count().is(0),loops().is(eq(2)))) .path() ``` --- .../process/traversal/strategy/optimization/CountStrategy.java | 1 + 1 file changed, 1 insertion(+) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/CountStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/CountStrategy.java index 3def9691473..d0832f68e1b 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/CountStrategy.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/CountStrategy.java @@ -164,6 +164,7 @@ public void apply(final Traversal.Admin traversal) { } else { inner = __.identity().asAdmin(); } + traversal.getGraph().ifPresent(graph -> inner.setGraph(graph)); if (prev != null) TraversalHelper.replaceStep(prev, new NotStep<>(traversal, inner), traversal); else