ehddnr301 opened a new issue, #4096:
URL: https://github.com/apache/iceberg-python/issues/4096

   ### Apache Iceberg version
   
   0.12.0 (latest release)
   
   ### Please describe the bug 🐞
   
   When `rest-page-size` is set, `list_tables`, `list_views` and 
`list_namespaces` send `pageSize` without `pageToken` on the first request:
   
   ```
   GET /v1/namespaces/ns/tables?pageSize=100
   ```
   
   <!-- markdown-link-check-disable-next-line -->
   The REST spec says servers must return all results in one response when 
`pageToken` is not set, and that clients start pagination by sending an empty 
`pageToken` 
([PageToken](https://github.com/apache/iceberg/blob/561a4e326fe77704e1e3e1d09507f121491a6b54/open-api/rest-catalog-open-api.yaml#L2386-L2408)).
 So compliant servers ignore `rest-page-size`, and some servers fail on the 
request. With `tabulario/iceberg-rest:1.6.0` and namespaces `a`, `b`, `c`:
   
   ```python
   RestCatalog("t", uri=uri).list_namespaces()
   # [('a',), ('b',), ('c',)]
   
   RestCatalog("t", uri=uri, **{"rest-page-size": "1"}).list_namespaces()
   # ServerError: NumberFormatException: Cannot parse null string
   ```
   
   ```
   GET /v1/namespaces?pageSize=1             -> 500 NumberFormatException
   GET /v1/namespaces?pageSize=1&pageToken=  -> {"namespaces": [["a"]], 
"next-page-token": "1"}
   ```
   
   <!-- markdown-link-check-disable-next-line -->
   The first request should include `pageToken=` when `rest-page-size` is set. 
The [Java 
client](https://github.com/apache/iceberg/blob/561a4e326fe77704e1e3e1d09507f121491a6b54/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java#L332-L351)
 always sends `pageToken`, starting with an empty value. The SigV4 adapter also 
needs to keep blank query values, since `parse_qsl` drops them by default.
   
   `rest-page-size` was added in #3377. The same error in 
`apache/iceberg-rest-fixture` was reported in apache/iceberg#13119.
   
   ### Willingness to contribute
   
   - [x] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to