kevinjqliu commented on code in PR #13129:
URL: https://github.com/apache/iceberg/pull/13129#discussion_r2105907785
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -565,13 +568,16 @@ public List<Namespace> listNamespaces(SessionContext
context, Namespace namespac
}
ImmutableList.Builder<Namespace> namespaces = ImmutableList.builder();
- String pageToken = "";
+ String pageToken = null;
if (pageSize != null) {
queryParams.put("pageSize", String.valueOf(pageSize));
}
do {
- queryParams.put("pageToken", pageToken);
+ if (pageToken != null) {
+ queryParams.put("pageToken", pageToken);
+ }
+
Review Comment:
since `pageToken` is always `null` at the start, how about something like
this? update the `queryParams` only when `pageToken` is updated.
```
String pageToken = null;
if (pageSize != null) {
queryParams.put("pageSize", String.valueOf(pageSize));
}
do {
AuthSession contextualSession = authManager.contextualSession(context,
catalogAuth);
ListTablesResponse response =
client
.withAuthSession(contextualSession)
.get(
paths.tables(ns),
queryParams,
ListTablesResponse.class,
Map.of(),
ErrorHandlers.namespaceErrorHandler());
pageToken = response.nextPageToken();
if (pageToken != null) {
queryParams.put("pageToken", pageToken);
}
tables.addAll(response.identifiers());
} while (pageToken != null);
```
--
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]