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

Add pagination to open api spec for listing of namespaces, tables, views #9660

Merged
merged 14 commits into from
Feb 29, 2024

Conversation

rahil-c
Copy link
Contributor

@rahil-c rahil-c commented Feb 5, 2024

Dev List discussion thread around adding support for pagination in list namespaces, tables, and views: https://lists.apache.org/thread/lql05h02qtp8mgq74ovhb0ndd76ck4f3

Credit to @emkornfield for creating this google doc for listing all cases which this change is based off: https://docs.google.com/document/d/1bbfoLssY1szCO_Hm3_93ZcN0UAMpf7kjmpwHQngqQJ0/edit

cc @jackye1995 @rdblue @danielcweeks

Testing

Ran make install, make lint, and python3 rest-catalog-open-api.py without issues.`

Copy link
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

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

I think we are missing the ListViews API?

Copy link
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

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

looks good to me!

Clients will initiate the first paginated request by sending an empty `pageToken` e.g. `GET /tables?pageToken` or `GET /tables?pageToken=`
signaling to the service that the response should be paginated.

For servers that support pagination, they will recognize `pageToken` and return a `next-page-token` in response if there are more results available.
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think the wording can be improved in this section to avoid using they to refer to servers. I did a previous suggestion which avoids using they

Copy link
Contributor

Choose a reason for hiding this comment

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

additionally it's confusing to use pageToken and next-page-token (vs nextPageToken), so which one is correct here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I still think the wording can be improved in this section to avoid using they to refer to servers. I did a previous suggestion which avoids using they

+1

additionally it's confusing to use pageToken and next-page-token (vs nextPageToken), so which one is correct here?

I think we probably have to use next-page-token instead of nextPageToken, because it is the actual field name.

Copy link
Contributor Author

@rahil-c rahil-c Feb 25, 2024

Choose a reason for hiding this comment

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

+1 for using next-page-token, @nastra removed usage of they, let me know if everything looks good and we can land this?

@rahil-c
Copy link
Contributor Author

rahil-c commented Feb 27, 2024

@jackye1995 can we merge this?

@jackye1995
Copy link
Contributor

Looks like it's still pending review from @danielcweeks? Is there any further comments?

Copy link
Contributor

@danielcweeks danielcweeks left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks @rahil-c !

@danielcweeks danielcweeks merged commit acbf96f into apache:main Feb 29, 2024
3 checks passed
bitsondatadev pushed a commit to bitsondatadev/iceberg that referenced this pull request Mar 3, 2024
…ews (apache#9660)

* Add pagination to open api spec for listing of namespaces, tables, views

* Rev for pagination in open api spec

* Fix writing in pagination descriptions

* Use opaque token

* Rev on pagination pr writing

* Rev on pagination pr writing py file

* Rev on description for pageSize

* revise pageToken description

* minor rev and make int for pageSize

* minor rev and remove emtpy val true for pageSize

* use only PageToken instead of NextPageToken

* address jack and nastra comments

* address final comments

* remove they and use min 1 for pageSize

---------

Co-authored-by: Rahil Chertara <rchertar@amazon.com>

Servers that support pagination will recognize `pageToken` and return a `next-page-token` in response if there are more results available.
After the initial request, it is expected that the value of `next-page-token` from the last response is used in the subsequent request.
Servers that do not support pagination will ignore `next-page-token` and return all results.
Copy link
Contributor

Choose a reason for hiding this comment

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

Servers that do not support pagination will ignore pageToken right? This should be the query param not the response field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix this.

PageToken:
description:
An opaque token which allows clients to make use of pagination for a list API (e.g. ListTables).
Clients will initiate the first paginated request by sending an empty `pageToken` e.g. `GET /tables?pageToken` or `GET /tables?pageToken=`
Copy link
Contributor

Choose a reason for hiding this comment

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

@rahil-c, in a spec you always want to be specific, not give options. Options make the spec more complicated. Here, only the second form should be added. The first form with no = is not recommended.

Copy link
Contributor

@jackye1995 jackye1995 Mar 4, 2024

Choose a reason for hiding this comment

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

Trying to remember what was decided during the community sync discussion, https://www.youtube.com/watch?v=uAQVGd5zV4I, starting at 45:04, seems like you said we should support both there. But maybe it's a misunderstanding of what Rahil meant there when he was talking about the first option of value not present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rdblue @jackye1995 Yea I think based on the community sync I thought we were suppose to be flexible for what users can do hence I included the two options in the description.

I can remove the first form if needed.

devangjhabakh pushed a commit to cdouglas/iceberg that referenced this pull request Apr 22, 2024
…ews (apache#9660)

* Add pagination to open api spec for listing of namespaces, tables, views

* Rev for pagination in open api spec

* Fix writing in pagination descriptions

* Use opaque token

* Rev on pagination pr writing

* Rev on pagination pr writing py file

* Rev on description for pageSize

* revise pageToken description

* minor rev and make int for pageSize

* minor rev and remove emtpy val true for pageSize

* use only PageToken instead of NextPageToken

* address jack and nastra comments

* address final comments

* remove they and use min 1 for pageSize

---------

Co-authored-by: Rahil Chertara <rchertar@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants