kevinjqliu commented on code in PR #13129:
URL: https://github.com/apache/iceberg/pull/13129#discussion_r2105182161


##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -111,7 +111,8 @@ public CommitFailedException wrapped() {
   }
 
   private static <T> Pair<List<T>, String> paginate(List<T> list, String 
pageToken, int pageSize) {
-    int pageStart = INITIAL_PAGE_TOKEN.equals(pageToken) ? 0 : 
Integer.parseInt(pageToken);
+    int pageStart =
+        pageToken == null || INITIAL_PAGE_TOKEN.equals(pageToken) ? 0 : 
Integer.parseInt(pageToken);

Review Comment:
   nit: i feel like this is more readable. wdyt?
   ```suggestion
       if (pageToken == null) {
           pageToken = INITIAL_PAGE_TOKEN;
       }
   
       int pageStart = INITIAL_PAGE_TOKEN.equals(pageToken) ? 0 : 
Integer.parseInt(pageToken);
   ```



##########
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:
   this is fine, i just want to mention that `pageToken` can be null too 



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to