Skip to content

Conversation

@rahil-c
Copy link
Contributor

@rahil-c rahil-c commented Mar 10, 2024

Incorporated feedback from recent pagination spec fix prs into this one.

cc @jackye1995 @rdblue @danielcweeks @geruh @nastra

signaling to the service that the response should be paginated.
An opaque token that allows clients to make use of pagination for list APIs
(e.g. ListTables). Clients may initiate the first paginated request by sending an empty
query parameter `pageToken` to the server 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.

I don't think this should have multiple "examples" that conflict with one another. If an example is necessary (and I don't think that it is) then there should be only one recommendation in a spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, will include one example then with the = form, based on your recommendation from prior pagination pr.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, I prefer removing these examples because this is an area that should be covered by the OpenAPI spec. The purpose of OpenAPI is to allow us to specify these things without ambiguity. I would prefer relying on that rather than giving an example here at all.

But if you want to have an example, there should be only one example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think your point is fair I only see one example of this in the rest spec https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L198

So for now will remove these examples based on your feedback.

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 I did see those examples too and I think the difference there is there may be some confusion about how namespaces are encoded where as here, an empty query parameter really isn't ambiguous and is covered by standard URL specification.

Servers that support pagination should identify the `pageToken` parameter and return a
`next-page-token` in the response if there are more results available. After the initial
request, the value of `next-page-token` from each response must be used as the `pageToken`
parameter value for the next request. The server must omit or return `null` value for the
Copy link
Contributor

Choose a reason for hiding this comment

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

A spec should not specify two options. I think the service should send null.

Copy link
Contributor Author

@rahil-c rahil-c Mar 12, 2024

Choose a reason for hiding this comment

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

Ok just want to clarify what we mean by the service should send null (does it mean the same as omitting the field). Since in the last line of the pagination description i think we wrote this

Servers that do not support pagination should ignore the pageToken parameter and return
all results in a single response. The next-page-token must be omitted or set to null

If setting null on service side means the same as service is omitting the next-page-token field in the response, something like this

ListIcebergNameResponse {
 "namespaces" : [...]
}

then would it be clearer to just write the service should omit next-page-token when no more results are available?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sending null and omitting the field are different. This should explicitly send null for next-page-token. The idea is to always be clear about what, exactly, should be sent. Clients need to interpret both null and missing to stop further requests. But for a service what to send must always be clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the clarification will fix this.

`next-page-token` in the last response.

Servers that support pagination must return all results in a single response with the value
of `next-page-token` omitted or set to `null` if the query parameter `pageToken` is not set in the
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the option here.

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 remove

request.

Servers that do not support pagination should ignore the `pageToken` parameter and return
all results in a single response. The `next-page-token` must be omitted or set to `null`
Copy link
Contributor

Choose a reason for hiding this comment

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

Must be omitted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So above I think you mentioned to use the service should send null. but here you mentioned to use must be omitted. Just want to confirm which option we should say across the description to be consistent( I think omission makes sense to me)

Copy link
Contributor

Choose a reason for hiding this comment

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

This is for services that do not support pagination, like all existing ones. In that case, they should not send the key. The difference is between not supporting pagination and ending paginated request exchanges.

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 thanks for clarifying this.

@rahil-c rahil-c requested review from danielcweeks and rdblue March 16, 2024 00:23
@rahil-c
Copy link
Contributor Author

rahil-c commented Mar 16, 2024

Was wondering if you @nastra or @amogh-jahagirdar can take a look whenever you get a chance, appreciate it.

@rdblue
Copy link
Contributor

rdblue commented Mar 22, 2024

Look good. Thanks, @rahil-c!

@rdblue rdblue merged commit 5d58750 into apache:main Mar 22, 2024
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
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.

3 participants