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 7553687edadc59ff4db0a7ce6c296b4c6ad568fd
Author: Andrea Child <[email protected]>
AuthorDate: Fri Aug 29 22:52:01 2025 -0700

    Only throw FastNoSuchElementException when not using iteration counts.
---
 .../gremlin/process/traversal/step/branch/RepeatStep.java   | 13 +++++++++----
 .../process/traversal/step/filter/RangeGlobalStep.java      |  8 ++++++--
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
index 2aa7ca9355..644aa9f7e6 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
@@ -366,12 +366,17 @@ public final class RepeatStep<S> extends 
ComputerAwareStep<S, S> implements Trav
                     start.resetLoops();
                     return IteratorUtils.of(start);
                 } else {
-                    System.out.printf("RepeatEndStep continuing repeat: %s%n", 
-                        ((Vertex) start.get()).property("id").value());
-                    if (!repeatStep.untilFirst && !repeatStep.emitFirst)
+                    System.out.printf("RepeatEndStep continuing repeat: %s 
Loops: %d%n", 
+                        ((Vertex) start.get()).property("id").value(), 
start.loops());
+                    if (!repeatStep.untilFirst && !repeatStep.emitFirst) {
                         repeatStep.repeatTraversal.addStart(start);
-                    else
+                        System.out.printf("RepeatEndStep added start to 
repeatTraversal: %s Loops: %d%n",
+                                ((Vertex) start.get()).property("id").value(), 
start.loops());
+                    } else {
                         repeatStep.addStart(start);
+                        System.out.printf("RepeatEndStep adding start to 
repeatStep: %s Loops: %d%n",
+                                ((Vertex) start.get()).property("id").value(), 
start.loops());
+                    }
                     if (repeatStep.doEmit(start, false)) {
                         final Traverser.Admin<S> emitSplit = start.split();
                         emitSplit.resetLoops();
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 07dd40e277..c9d5d1ed7d 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
@@ -100,8 +100,12 @@ public final class RangeGlobalStep<S> extends 
FilterStep<S> implements Ranging,
         }
 
         if (this.high != -1 && currentCounter.get() >= this.high) {
-            System.out.printf("Filtering out traverser (reached high limit): 
%s Counter: %d%n", traverser.path(), currentCounter.get());
-            return false;
+            if (usePerIterationCounters) {
+                System.out.printf("Filter false for Traverser: %s Counter: 
%d%n", traverser.path(), currentCounter.get());
+                return false;
+            }
+            System.out.printf("FastNoSuchElementException for Traverser: %s 
Counter: %d%n", traverser.path(), currentCounter.get());
+            throw FastNoSuchElementException.instance();
         }
 
         long avail = traverser.bulk();

Reply via email to