spmallette commented on code in PR #3241:
URL: https://github.com/apache/tinkerpop/pull/3241#discussion_r2445970437


##########
docs/src/upgrade/release-3.8.x.asciidoc:
##########
@@ -830,6 +843,46 @@ g.V().repeat(both()).times(2).dedup()
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-3192[TINKERPOP-3192]
 
+==== Modified limit() skip() range() Semantics in repeat()
+
+The semantics of globally-scoped `limit()`, `skip()`, and `range()` steps 
inside `repeat()` have been modified to ensure 
+consistent semantics across repeat iterations.Previously, these steps would 
track global counters, leading to unexpected 
+behavior where subsequent iterations of `limit()` and `range()` would filter 
all traversers as previous iterations 
+reached the global limits. In the case of `skip()`, traversers would be passed 
to subsequent iterations when they should 
+have been filtered. As of 3.8.0 the counters are tracked per iteration.
+
+[source,groovy]
+----
+// 3.7.4 - grateful dead graph examples producing no results due to global 
counters
+gremlin> 
g.withoutStrategies(RepeatUnrollStrategy).V().has('name','JAM').repeat(out('followedBy').limit(2)).times(2).values('name')
+gremlin>
+gremlin> 
g.withoutStrategies(RepeatUnrollStrategy).V().has('name','DRUMS').repeat(in('followedBy').range(1,3)).times(2).values('name')
+gremlin>
+// 3.7.4 - modern graph examples demonstrating too many results with skip in 
repeat due to global counters
+gremlin> 
g.withoutStrategies(RepeatUnrollStrategy).V(1).repeat(out().skip(1)).times(2).values('name')
+==>ripple
+==>lop
+gremlin> 
g.withoutStrategies(RepeatUnrollStrategy).V(1).out().skip(1).out().skip(1).values('name')
+==>lop
+
+// 3.8.0 - grateful dead graph examples producing results as limit counters 
tracked per iteration
+gremlin> 
g.V().has('name','JAM').repeat(out('followedBy').limit(2)).times(2).values('name')
+==>[name:[vp[name->HURTS ME TOO]]]
+==>[name:[vp[name->BLACK THROATED WIND]]]
+gremlin> 
g.V().has('name','DRUMS').repeat(in('followedBy').range(1,3)).times(2).values('name')
+==>DEAL
+==>WOMEN ARE SMARTER
+// 3.8.0 - modern graph examples demonstrating consistent skip semantics
+gremlin> g.V(1).repeat(out().skip(1)).times(2).values('name')
+==>lop
+gremlin> g.V(1).out().skip(1).out().skip(1).values('name')
+==>lop
+----
+
+This change ensures that globally-scoped `limit()`, `skip()`, and `range()` 
steps inside `repeat()` now use per-iteration 
+counters, making the behavior consistent with manually unrolled traversals. 
Locally-scoped variants of these steps are 
+not affected by these changes.

Review Comment:
   This section kinda ends without much explanation as to the impact here. What 
should folks be considering as they upgrade? Like, what do they need to 
consider about their code as a result of all you've described?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to