You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ly...@apache.org on 2024/09/11 21:14:43 UTC
(tinkerpop) branch fix-onGraphComputer-3.6 updated: fix for onGraphComputer function returning false when it is a graph computer traversal.
This is an automated email from the ASF dual-hosted git repository.
lyndonb pushed a commit to branch fix-onGraphComputer-3.6
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/fix-onGraphComputer-3.6 by this push:
new e4f912ad53 fix for onGraphComputer function returning false when it is a graph computer traversal.
e4f912ad53 is described below
commit e4f912ad534cdcaeb32f2c0b9c1dfed8930f49ab
Author: lyndon <ly...@apache.org>
AuthorDate: Wed Sep 11 14:14:33 2024 -0700
fix for onGraphComputer function returning false when it is a graph computer traversal.
---
.../gremlin/process/traversal/util/TraversalHelper.java | 2 +-
.../gremlin/tinkergraph/structure/TinkerGraphTest.java | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 19117d6e9a..ca751a4f88 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -711,7 +711,7 @@ public final class TraversalHelper {
return true;
traversal = traversal.getParent().asStep().getTraversal();
}
- return false;
+ return traversal.getSteps().get(0) instanceof TraversalVertexProgramStep;
}
public static void removeAllSteps(final Traversal.Admin<?, ?> traversal) {
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 12d0fec5cc..ffdc8736e6 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -26,11 +26,13 @@ import org.apache.tinkerpop.gremlin.process.computer.Computer;
import org.apache.tinkerpop.gremlin.process.traversal.P;
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.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IdentityRemovalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReservedKeysVerificationStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -58,6 +60,7 @@ import org.apache.tinkerpop.shaded.kryo.Registration;
import org.apache.tinkerpop.shaded.kryo.Serializer;
import org.apache.tinkerpop.shaded.kryo.io.Input;
import org.apache.tinkerpop.shaded.kryo.io.Output;
+import org.junit.Assert;
import org.junit.Test;
import java.awt.Color;
@@ -662,6 +665,13 @@ public class TinkerGraphTest {
}
}
+ @Test
+ public void shouldReturnOnGraphComputerTrue() {
+ final GraphTraversalSource g = TinkerFactory.createModern().traversal().withComputer();
+ final GraphTraversal.Admin traversal = g.V().out().iterate().asAdmin();
+ Assert.assertTrue(TraversalHelper.onGraphComputer(traversal));
+ }
+
/**
* Just validating that property folding works nicely given TINKERPOP-2112
*/