You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by "L0Lmaker (via GitHub)" <gi...@apache.org> on 2026/05/02 03:55:20 UTC
[PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "Cole-Greer (via GitHub)" <gi...@apache.org>.
Cole-Greer commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4424269942
VOTE +1
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "L0Lmaker (via GitHub)" <gi...@apache.org>.
L0Lmaker commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4365589637
Thanks for the review @Cole-Greer. Pushed `584ada5d4d` to address both points:
- Go translators in `gremlin-core` and `gremlin-javascript` now emit `NextN(n)` for the `next(n)` terminal step (no-arg `next()` continues to map to `Next()`). Implemented as a `visitTraversalTerminalMethod_next` override in each translator, since the symbol-mapping layer doesn't see the integer-argument distinction. Existing parameterized test rows updated.
- Added a short paragraph in `gremlin-variants.asciidoc` under the Go `=== Differences` section explaining why the batched form is exposed as a sibling method.
- Expanded the CHANGELOG bullet to also name the translator updates, matching the prior `gremlin-go` + `GoTranslatorVisitor` entry already in the 4.0.0 section.
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "xiazcy (via GitHub)" <gi...@apache.org>.
xiazcy commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4425464197
VOTE +1, thanks for the PR Rithin! I would ask that you open companion PRs for 3.7/3.8, this would be a nice feature to patch up in the existing versions as well.
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4362890040
## [Codecov](https://app.codecov.io/gh/apache/tinkerpop/pull/3416?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 77.92%. Comparing base ([`cfd6889`](https://app.codecov.io/gh/apache/tinkerpop/commit/cfd68897ea111e3ae7100dbc2f0f7a364fd0ffa5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0169556`](https://app.codecov.io/gh/apache/tinkerpop/commit/0169556225fd7968f6f9cabb303129d4774b902d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1033 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #3416 +/- ##
============================================
+ Coverage 77.87% 77.92% +0.05%
============================================
Files 1015 27 -988
Lines 59308 5736 -53572
Branches 6835 0 -6835
============================================
- Hits 46184 4470 -41714
+ Misses 10817 1044 -9773
+ Partials 2307 222 -2085
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/tinkerpop/pull/3416?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "spmallette (via GitHub)" <gi...@apache.org>.
spmallette commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4363617916
Thanks for the PR. I'll leave it to the Go experts to dig into the details here but I'm interested in the signoff since I recently added that instruction to our AGENTS setup:
> Assisted-by: Claude:claude-opus-4-7 [Claude Code]
It signed like this too for me yesterday as a first time using that instruction. I'd envisioned:
> Assisted-by: Claude Code:claude-opus-4-7
I might need to better define that to get what I want there. It's interpreting the "tool" to be Claude Code - maybe because the tool is not seen as optional??
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "L0Lmaker (via GitHub)" <gi...@apache.org>.
L0Lmaker merged PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "Cole-Greer (via GitHub)" <gi...@apache.org>.
Cole-Greer commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4365353554
Thanks for opening the PR, the `NextN(n)` syntax seems like a good workaround considering Go's lack of overloading support. Since this differs from the other drivers, I think it might warrant a brief shoutout in the [Go differences reference docs](https://github.com/apache/tinkerpop/blob/3ad5a83983f46bc90f82079ce8d402549d696040/docs/src/reference/gremlin-variants.asciidoc?plain=1#L499-L500).
This should also get added to the Go translators in [Java](https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/translator/GoTranslateVisitor.java) and [JS](https://github.com/apache/tinkerpop/blob/master/gremlin-js/gremlin-javascript/lib/language/translator/GoTranslateVisitor.ts).
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TINKERPOP-3244 Add NextN(n) to Traversal in gremlin-go [tinkerpop]
Posted by "L0Lmaker (via GitHub)" <gi...@apache.org>.
L0Lmaker commented on PR #3416:
URL: https://github.com/apache/tinkerpop/pull/3416#issuecomment-4364192888
Thanks @spmallette! Updated the commit message — the trailer now reads `Assisted-by: Claude Code:claude-opus-4-7`. Branch force-pushed at `d396815e4c`.
For future reference (and anyone else interpreting the AGENTS.md template), I read `AGENT_NAME:MODEL_VERSION [TOOL]` literally and matched the existing precedent in `0531cbb7d0` (`Assisted-by: Kiro:claude-opus-4.6 [kiro-cli]`), which appears to have hit the same ambiguity. Happy to look at AGENTS.md wording in a separate PR if helpful.
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org