minimal API changes for 0-based offsets#1482
Open
njr-11 wants to merge 3 commits into
Open
Conversation
FroMage
reviewed
Jun 4, 2026
Good catch - I rearranged some text that was there previously and you spotted an error in it. Co-authored-by: Stéphane Épardaud <stef@inforealm.org>
otaviojava
reviewed
Jun 4, 2026
| Messages.get("004.arg.negative", "offset")); | ||
| } | ||
|
|
||
| if (offset == Long.MAX_VALUE) { |
Contributor
There was a problem hiding this comment.
I am not sure about this one here.
- the Long.MAX_VALUE still a valid number right?
Why is this not supported?
Member
Author
There was a problem hiding this comment.
1. the Long.MAX_VALUE still a valid number right?Why is this not supported?
Of course it's a valid number. But an offset of Long.MAX_VALUE from the first result has a page number (Long.MAX_VALUE + 1) that is not representable as a positive long value. If we allowed it, what would you propose to return when a user/Data provider asks the API for the page number?
Member
There was a problem hiding this comment.
10^19 is an implausible number of rows.
There was a problem hiding this comment.
You know, that's precisely how many rows I have. Make it work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR starts with some of Gavin's updates from #1479 and pares down to a minimum the amount of API updates needed to accommodate a developer that wants to think about making PageRequests as a 0-based offset from the first page and defining Limits in terms of a 0-based offset from first result.
To achieve this, we really only need 2 methods.
pageOffset(offset)forPageRequest:limit.of(maxResults, offset)forLimit: