From 6fd47600d09cc60e68adc1d3fcd65a96f00b1563 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 13 Jun 2022 23:38:52 +0800 Subject: [PATCH 1/2] 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 From 0b8dd542b9bb5332bca34330a796300e379446b8 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 21 Jun 2022 16:46:50 +0800 Subject: [PATCH 2/2] add a CHANGELOG entry --- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4c1a25fc077..7d347a0b450 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -41,6 +41,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Deprecated and removed functionality of the `connectOnStartup` option in `gremlin-javascript` to resolve potential `unhandledRejection` and race conditions. * Fixed potential `NullPointerException` in `gremlin-driver` where initialization of a `ConnectionPool` would fail but not throw an exception due to centralized error check being satisfied by a different process. * Fixed a bug where the JavaScript client would hang indefinitely on traversals if the connection to the server was terminated. +* Fixed Traversal.graph is empty in StepStrategy.apply() with `count().is(0)`. [[release-3-5-3]] === TinkerPop 3.5.3 (Release Date: April 4, 2022)