markhoerth opened a new issue, #14454:
URL: https://github.com/apache/gravitino/issues/14454
### Version
main branch
### Describe what's wrong
`GET /v1/{prefix}/namespaces?pageSize=10`, with no `pageToken` parameter,
returns the first 10 namespaces and a `next-page-token`. The same happens for
list tables and list views. The REST spec (`components/schemas/PageToken`)
says: "Servers that support pagination must return all results in a single
response with the value of `next-page-token` set to `null` if the query
parameter `pageToken` is not set in the request", and clients start paging by
sending an empty `pageToken`. A client that sends only `pageSize` gets a
truncated list with no error.
The cause is in `IcebergPaginationHelper.paginate`: an absent `pageToken` is
treated like an empty one, and a present `pageSize` always slices the list.
### Error message and/or stacktrace
```
GET /v1/cat/namespaces?pageSize=10 10 of 1,031,
"next-page-token": "..."
GET /v1/cat/namespaces/ns/tables?pageSize=1 1 of 2,
"next-page-token": "..."
```
### How to reproduce
1. Create more than 10 namespaces.
2. `GET /v1/{prefix}/namespaces?pageSize=10`: 10 namespaces and a next-page
token.
3. `GET /v1/{prefix}/namespaces?pageToken=&pageSize=10` is a correct first
page; `GET /v1/{prefix}/namespaces` returns all.
### Additional context
The Iceberg Java client always sends `pageToken` and is not affected;
scripts and other SDKs that send `pageSize` as a size hint are.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]