L0Lmaker opened a new pull request, #3416: URL: https://github.com/apache/tinkerpop/pull/3416
## Summary - Adds `Traversal.NextN(n int) ([]*Result, error)` to gremlin-go for batched result iteration, providing API parity with `next(n)` in the Java, Python, and .NET GLVs. - Behavior matches the Java reference (`Traversal.java:107`): returns up to `n` results, returns what is available if fewer exist, returns an empty slice for `n <= 0`, and surfaces `ResultSet` errors. - Method name is `NextN` rather than `Next(n int)` because Go does not support method overloading — a literal port of the Java signature would collide with the existing `Next() (*Result, error)`. This matches the existing pattern in gremlin-go where overloaded Java APIs are split into distinctly-named Go methods (e.g. `ResultSet.One()` vs `ResultSet.All()`). ## JIRA [TINKERPOP-3244](https://issues.apache.org/jira/browse/TINKERPOP-3244) ## Backport question for maintainers The JIRA lists Affects Versions `3.7.5, 3.8.1`. Per the PR template I would normally target the earliest branch and let it merge forward, but the iteration model in gremlin-go diverged on master (`GremlinLang` + `nextValue()` helper) vs `3.7-dev` / `3.8-dev` (`Bytecode` + `One()` directly). The implementation here is master-shaped and won't forward-merge cleanly without a rewrite for the older protocol. Targeting `master` for now. **Please let me know your preference** — happy to open companion PRs against `3.7-dev` and `3.8-dev` with implementations matching their respective iteration models if that is how you would like it landed. ## Test plan - [x] `go build ./...` clean - [x] `go vet ./driver/` clean - [x] `gofmt` clean - [x] 9 new unit tests in `TestTraversalNextN` cover: `n < available`, `n == available`, `n > available`, `n = 0`, `n < 0`, exhausted traversal, bulked traverser unrolling across batch boundary, repeated drain calls, error propagation - [x] Existing tests (`TestTraversalNextValue`, `TestTraversal/Test_clone_traversal`, `TestTraversal/Test_Iterate_with_empty_removeConnection`) still pass - [x] Full integration suite via `./run.sh 4.0.0-beta.2`: 2017/2043 cucumber scenarios pass, all gremlin-go tests including `TestTraversalNextN` pass. The single failing scenario (`g_injectXnull_nullX_conjoinXplusX`) is unrelated to this change — pre-existing client/server version skew where the master client expects the post-TINKERPOP-3225 server fix that is not in the published `4.0.0-beta.2` server image. ## Notes This change was AI-assisted; the commit includes the `Assisted-by:` trailer per `AGENTS.md`. -- 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]
