This is an automated email from the ASF dual-hosted git repository.

colegreer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new e5b2a165c7 CTR Update TinkerGraphStep and TinkerGraphStepStrategy to 
operate on GraphStepContract
e5b2a165c7 is described below

commit e5b2a165c73c8e30ecce242b2947d8bada6b2fda
Author: Cole-Greer <[email protected]>
AuthorDate: Tue Sep 30 13:34:59 2025 -0700

    CTR Update TinkerGraphStep and TinkerGraphStepStrategy to operate on 
GraphStepContract
---
 .../process/traversal/step/sideEffect/TinkerGraphStep.java  |  3 ++-
 .../strategy/optimization/TinkerGraphStepStrategy.java      |  3 ++-
 .../strategy/optimization/TinkerGraphStepStrategyTest.java  | 13 +++++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
index a9615f6c07..0f9d1c2923 100644
--- 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
+++ 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Compare;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import 
org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStepContract;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -54,7 +55,7 @@ public final class TinkerGraphStep<S, E extends Element> 
extends GraphStep<S, E>
      */
     private final List<Iterator> iterators = new ArrayList<>();
 
-    public TinkerGraphStep(final GraphStep<S, E> originalGraphStep) {
+    public TinkerGraphStep(final GraphStepContract<S, E> originalGraphStep) {
         super(originalGraphStep.getTraversal(), 
originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), 
originalGraphStep.getIds());
         originalGraphStep.getLabels().forEach(this::addLabel);
 
diff --git 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategy.java
 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategy.java
index 5acb3ad68d..37b128ca0a 100644
--- 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategy.java
+++ 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategy.java
@@ -24,6 +24,7 @@ import 
org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import 
org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStepContract;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
 import 
org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
@@ -47,7 +48,7 @@ public final class TinkerGraphStepStrategy extends 
AbstractTraversalStrategy<Tra
         if (TraversalHelper.onGraphComputer(traversal))
             return;
 
-        for (final GraphStep originalGraphStep : 
TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
+        for (final GraphStepContract originalGraphStep : 
TraversalHelper.getStepsOfClass(GraphStepContract.class, traversal)) {
             final TinkerGraphStep<?, ?> tinkerGraphStep = new 
TinkerGraphStep<>(originalGraphStep);
             TraversalHelper.replaceStep(originalGraphStep, tinkerGraphStep, 
traversal);
             Step<?, ?> currentStep = tinkerGraphStep.getNextStep();
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategyTest.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategyTest.java
index b44d90fa22..42f6d4ffc0 100644
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategyTest.java
+++ 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategyTest.java
@@ -25,6 +25,7 @@ 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.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.GValue;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
 import 
org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy;
@@ -90,6 +91,13 @@ public class TinkerGraphStepStrategyTest {
         return traversal.addStep(graphStep);
     }
 
+    private static GraphTraversal.Admin<?, ?> g_Vid(final Object[] ids, final 
Object... hasKeyValues) {
+        final GraphTraversal.Admin<?, ?> traversal = new 
DefaultGraphTraversal<>();
+        final GraphStep<?, ?> graphStep = V(hasKeyValues);
+        graphStep.addIds(ids);
+        return traversal.addStep(graphStep);
+    }
+
     private static GraphStep<?, ?> V(final Object... hasKeyValues) {
         final TinkerGraphStep<Vertex, Vertex> graphStep = new 
TinkerGraphStep<>(new GraphStep<>(EmptyTraversal.instance(), Vertex.class, 
true));
         for (int i = 0; i < hasKeyValues.length; i = i + 2) {
@@ -103,7 +111,12 @@ public class TinkerGraphStepStrategyTest {
         final int LAZY_SIZE = 2500;
         return Arrays.asList(new Object[][]{
                 {__.V().out(), g_V().out(), Collections.emptyList()},
+                {__.V(1).out(), g_Vid(new Integer[]{1}).out(), 
Collections.emptyList()},
+                {__.V(GValue.of("id", 1)).out(), g_Vid(new 
Integer[]{1}).out(), Collections.emptyList()}, // Note that GValue ids are 
currently reduced to literals as TinkerGraphStep is not currently equipped to 
handle GValues.
                 {__.V().has("name", "marko").out(), g_V("name", 
eq("marko")).out(), Collections.emptyList()},
+                {__.V().has("name", GValue.of("name", "marko")).out(), 
g_V("name", eq(GValue.of("name", "marko"))).out(), Collections.emptyList()},
+                {__.V(1).has("name", "marko").out(), g_Vid(new Integer[]{1}, 
"name", eq("marko")).out(), Collections.emptyList()},
+                {__.V(GValue.of("id", 1)).has("name", "marko").out(), 
g_Vid(new Integer[]{1}, "name", eq("marko")).out(), Collections.emptyList()},
                 {__.V().has("name", "marko").has("age", 
gt(31).and(lt(10))).out(),
                         g_V("name", eq("marko"), "age", gt(31), "age", 
lt(10)).out(), Collections.emptyList()},
                 {__.V().has("name", "marko").or(has("age"), has("age", 
gt(32))).has("lang", "java"),

Reply via email to