Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate naming / terminology away from "keyset" #525

Merged
merged 32 commits into from
Mar 8, 2024

Conversation

gavinking
Copy link
Contributor

See #504.

WDYT, folks?

@gavinking gavinking requested review from njr-11 and otaviojava and removed request for njr-11 March 6, 2024 20:49
@gavinking
Copy link
Contributor Author

Note that I've split this into 3 commits, with changes to javadoc, spec, and APIs done separately. Hope that makes for easier review.

@gavinking gavinking marked this pull request as ready for review March 6, 2024 20:52
Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good. I think the term "cursor-based pagination" will be better understood than "key-based pagination" and it better fits with the name CursoredPage. I added suggestions to change it, and after getting a ways into it was amazed at how many times we refer to it in the spec. I also wonder if "key values" will be misinterpreted as having multiple keys, rather than multiple elements that make up a single key. I added comments in some places for that as well.

api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
spec/src/main/asciidoc/repository.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/repository.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/repository.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/repository.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/repository.asciidoc Outdated Show resolved Hide resolved
@gavinking
Copy link
Contributor Author

I think the term "cursor-based pagination" will be better understood than "key-based pagination"

Yeah so I started typing that but then wondered if it was too easily-misunderstood as something to do with database cursors which it really most definitely is not.

@njr-11
Copy link
Contributor

njr-11 commented Mar 7, 2024

I think the term "cursor-based pagination" will be better understood than "key-based pagination"

Yeah so I started typing that but then wondered if it was too easily-misunderstood as something to do with database cursors which it really most definitely is not.

Both "cursor" and "key" have other meanings in the database and are overloaded in Jakarta Data. Our options will be that we can either use one of these overloaded terms or we can come up with a unique term for the idea of a composite key that is made up of the entity attribute values from the sort criteria. One attempt at the latter was "keyset", which is an already-existing term and not something we invented for Jakarta Data. A big problem with it is that its name will be literally interpreted as a "set of keys", but it is neither a set nor do the values that form it need to be keys. I do think it makes sense to try to find a better term.

I don't see using overloaded terms to necessarily be a problem. Jakarta Data defines a CursoredPage and a PageRequest.Cursor that matches up nicely with "Cursor-based Pagination" and gets the point across that a page is computed relative to a particular query result. "Key-based Pagination" doesn't have such direct correspondence to the API and will likely get users thinking of the primary key / @Id entity attribute. It is true that you could perform this sort of pagination based solely on the primary key, but I would expect it to typically be used in combination with additional sort criteria that are more meaningful to the user. I think most people are going to think of key as singular, with the possibility of composite key being an afterthought, which will make the term "Key-based Pagination" less intuitive than "Cursor-based Pagination".

@gavinking
Copy link
Contributor Author

OK I pushed a commit which makes the global change to "cursor-based".

Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest set of updates looks good. It looks like we lost a few other review comments which happened to overlap the same areas, and I did my best to re-enter them. This is mostly around avoidance of the phrase reverse direction which can mislead users into believing their previous pages will be sorted in reverse. There were also a few places with keyset that were missed and a few review comments to avoid confusion over "key values" being misunderstood as values that are keys rather than values for a single composite key. There should be suggestions for everything remaining in the pull now.

api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/CursoredPage.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/PageRequest.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/PageRequest.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/PageRequest.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/PageRequest.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/PageRequest.java Outdated Show resolved Hide resolved
@gavinking
Copy link
Contributor Author

I committed the suggestions.

Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I committed the suggestions.

Thanks. I still see 5 remaining, all of which are related to clarifying that the user is not being asked to supply multiple key values. They are being asked to supply multiple values that together form a single composite key.
At this point, it should be fine to approve it in advance because these are minor clarifications.

Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just spotted two others that were lost and re-added them.

api/src/test/java/jakarta/data/page/PaginationTest.java Outdated Show resolved Hide resolved
api/src/main/java/jakarta/data/page/Pagination.java Outdated Show resolved Hide resolved
@gavinking
Copy link
Contributor Author

I still see 5 remaining

I have committed the ones I can find, but I dunno, this system seems to be a bit flakey.

@gavinking
Copy link
Contributor Author

I managed to find some more by laboriously scrolling through the diff. They weren't showing up here.

@njr-11
Copy link
Contributor

njr-11 commented Mar 7, 2024

I managed to find some more by laboriously scrolling through the diff. They weren't showing up here.

Yeah, they were buried under git's "Show hidden comments" section, and even then were intermixed with a bunch of outdated ones. I went through and resolved all of the outdated ones and only after that was it clear which were remaining. It looks like you got them all now.

@otaviojava did you have any comments on this one before merging it? Our deadline for changes unrelated to the Query Language is this Friday.

@njr-11
Copy link
Contributor

njr-11 commented Mar 7, 2024

I added a commit to resolve merge conflicts with the {@code} pull

@gavinking
Copy link
Contributor Author

gavinking commented Mar 7, 2024

Going to have to squash this because the conflicts are bad.

@gavinking
Copy link
Contributor Author

I added a commit to resolve merge conflicts with the {@code} pull

Oh you did it? OK.

improve whitespace in CursoredPage to reduce "jagged" line endings
@gavinking
Copy link
Contributor Author

IMO, this one should now be merged.

@otaviojava otaviojava merged commit e36d772 into jakartaee:main Mar 8, 2024
3 checks passed
@otaviojava
Copy link
Contributor

I managed to find some more by laboriously scrolling through the diff. They weren't showing up here.

Yeah, they were buried under git's "Show hidden comments" section, and even then were intermixed with a bunch of outdated ones. I went through and resolved all of the outdated ones and only after that was it clear which were remaining. It looks like you got them all now.

@otaviojava did you have any comments on this one before merging it? Our deadline for changes unrelated to the Query Language is this Friday.

Nope, let's merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants