laserninja commented on code in PR #10671:
URL: https://github.com/apache/gravitino/pull/10671#discussion_r3296172942


##########
iceberg/iceberg-common/src/main/java/org/apache/gravitino/iceberg/common/ops/IcebergCatalogWrapper.java:
##########
@@ -451,6 +471,61 @@ public IcebergTableChange(TableIdentifier tableIdentifier, 
Transaction transacti
     }
   }
 
+  private int parsePageToken(@Nullable String pageToken) {
+    if (pageToken == null || pageToken.isEmpty()) {
+      return 0;
+    }
+    try {
+      int offset = Integer.parseInt(pageToken);
+      Preconditions.checkArgument(offset >= 0, "pageToken must be 
non-negative, got: %s", offset);
+      return offset;
+    } catch (NumberFormatException e) {
+      throw new IllegalArgumentException("Invalid pageToken: " + pageToken, e);
+    }
+  }
+
+  private ListNamespacesResponse paginateNamespaces(

Review Comment:
   extracted shared pagination logic into IcebergPaginationHelper (a 
package-private utility in the rest package). paginateNamespaces() and 
paginateTables() are separate methods since they operate on different response 
types (ListNamespacesResponse vs ListTablesResponse), but the core 
offset/subList logic is in one place now.



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

Reply via email to