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

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

commit a0e79cd9f3a6186b9e29435442b966d16ab822bd
Author: Andrea Child <[email protected]>
AuthorDate: Fri Aug 29 09:39:51 2025 -0700

    Draft code for logging, different test case.
---
 .../traversal/step/filter/RangeGlobalStep.java     | 23 ++++-----
 .../tinkergraph/structure/TinkerGraphPlayTest.java | 59 +++++++++++++++++++---
 2 files changed, 62 insertions(+), 20 deletions(-)

diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/RangeGlobalStep.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/RangeGlobalStep.java
index 0ec51e0b76..c0c0c86e35 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/RangeGlobalStep.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/RangeGlobalStep.java
@@ -18,13 +18,21 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.filter;
 
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.BinaryOperator;
 import org.apache.tinkerpop.gremlin.process.computer.MemoryComputeKey;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Bypassing;
 import org.apache.tinkerpop.gremlin.process.traversal.step.FilteringBarrier;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Ranging;
-import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.B_LP_NL_O_P_S_SE_SL_Traverser;
 import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
 import 
org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
@@ -32,16 +40,6 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.BinaryOperator;
-
 /**
  * @author Bob Briody (http://bobbriody.com)
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -75,8 +73,9 @@ public final class RangeGlobalStep<S> extends FilterStep<S> 
implements Ranging,
         if (usePerIterationCounters) {
             // Create counter key that isolates between different repeat step 
contexts
             String pathStructure = String.valueOf(traverser.path().size());
+            // consider removing the stepId from the key
             String iterationKey = this.getId() + ":" + traverser.loops() + ":" 
+ pathStructure;
-            Object vId = ((Vertex) ((B_LP_NL_O_P_S_SE_SL_Traverser) 
traverser).get()).property("id").value();
+            Object vId = ((Vertex) traverser.get()).property("id").value();
             currentCounter = 
perIterationCounters.computeIfAbsent(iterationKey, k -> new AtomicLong(0L));
             System.out.printf("IterationKey: %s Traverser: %s Path: %s 
Counter: %s High: %s%n", iterationKey, vId, traverser.path(), 
currentCounter.get(), this.high);
         }
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index 4a455a58a1..82d72c69a5 100644
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -69,11 +69,35 @@ public class TinkerGraphPlayTest {
     public void testIterationScopedRangeGlobalInRepeat() {
         GraphTraversalSource g = 
TinkerGraph.open().traversal().withoutStrategies(RepeatUnrollStrategy.class);
         load(g);
-        GraphTraversal<Vertex, Path> basic = g.V().has("id", 
"l1-0").repeat(__.limit(1).out("knows")).times(2).path().by("id");
+        GraphTraversal<Vertex, Path> basic = g.V().has("id", "l1-0")
+                .repeat(__.limit(1).out("knows"))
+                .times(2).path().by("id");
         toListAndPrint("basic", basic);
-        GraphTraversal<Vertex, Path> chained = g.V().has("id", 
"l2-0").repeat(__.limit(1).out("knows")).times(2).repeat(__.limit(1).in("knows")).times(2).path().by("id");
+        GraphTraversal<Vertex, Path> basicUnfolded = g.V().has("id", "l1-0")
+                .limit(1).out("knows")
+                .limit(1).out("knows")
+                .path().by("id");
+        toListAndPrint("basicUnfolded", basicUnfolded);
+
+        GraphTraversal<Vertex, Path> chained = g.V().has("id", "l2-0")
+                .repeat(__.limit(1).out("knows")).times(2)
+                .repeat(__.limit(1).in("knows")).times(2)
+                .path().by("id");
         toListAndPrint("chained", chained);
-        GraphTraversal<Vertex, Path> nested = g.V().has("id", 
"l3-0").repeat(__.limit(1).out("knows").repeat(__.limit(1).in("knows")).times(2)).times(2).path().by("id");
+        GraphTraversal<Vertex, Path> chainedUnfolded = g.V().has("id", "l2-0")
+                .limit(1).out("knows")
+                .limit(1).out("knows")
+                .limit(1).in("knows")
+                .limit(1).in("knows")
+                .path().by("id");
+        toListAndPrint("chainedUnfolded", chainedUnfolded);
+
+        GraphTraversal<Vertex, Path> nested = g.V().has("id", "l3-0")
+                .repeat(__.limit(1).out("knows")
+                        .repeat(__.limit(1).in("knows"))
+                        .times(2))
+                .times(2)
+                .path().by("id");
         toListAndPrint("nested", nested);
         GraphTraversal<Vertex, Path> nestedUnfolded = g.V().has("id", "l3-0")
                 .limit(1).out("knows")
@@ -94,7 +118,6 @@ public class TinkerGraphPlayTest {
                 .times(2)
                 .path().by("id");
         toListAndPrint("tripleNested", tripleNested);
-        
         GraphTraversal<Vertex, Path> tripleNestedUnfolded = g.V().has("id", 
"l1-0")
                 .limit(1).out("knows")
                 .limit(1).in("knows")
@@ -114,11 +137,31 @@ public class TinkerGraphPlayTest {
         toListAndPrint("tripleNestedUnfolded", tripleNestedUnfolded);
 
         GraphTraversal<Vertex, Path> nested2 = g.V().has("id", 
"l3-0").out("knows").
-                
repeat(__.limit(1).out("knows").repeat(__.limit(1).in("knows")).times(2)).
-                times(2).path().by("id");
+                repeat(__.limit(1).out("knows")
+                        .repeat(__.limit(1).in("knows"))
+                        .times(2)).
+                times(2)
+                .path().by("id");
         toListAndPrint("nested2", nested2);
-//        GraphTraversal<Vertex, Object> aggregate = g.V().has("id", 
"l1-0").repeat(__.limit(1).out("knows").aggregate("x")).times(2).cap("x");
-//        toListAndPrint("aggregate", aggregate);
+        GraphTraversal<Vertex, Path> nested2Unfolded = g.V().has("id", 
"l3-0").out("knows")
+                .limit(1).out("knows")
+                .limit(1).in("knows")
+                .limit(1).in("knows")
+                .limit(1).out("knows")
+                .limit(1).in("knows")
+                .limit(1).in("knows")
+                .path().by("id");
+        toListAndPrint("nested2Unfolded", nested2Unfolded);
+        GraphTraversal<Vertex, Object> aggregate = g.V().has("id", 
"l1-0").repeat(__.limit(1).out("knows").aggregate("x")).times(2).cap("x");
+        toListAndPrint("aggregate", aggregate);
+
+        GraphTraversal<Vertex, Path> test = g.V().has("id", "l1-0")
+                .union(out().limit(1), out().out().limit(1))
+                .repeat(__.limit(1))
+                .times(1).path().by("id");
+        toListAndPrint("test", test);
+        GraphTraversal<Vertex, Path> test2 = g.V().has("id", 
"l1-0").union(out().limit(1), out().out().limit(1)).limit(1).path().by("id");
+        toListAndPrint("test2", test2);
     }
     
     private void toListAndPrint(String header, GraphTraversal t) {

Reply via email to