nastra commented on code in PR #9782:
URL: https://github.com/apache/iceberg/pull/9782#discussion_r1559623826


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -278,14 +286,26 @@ public void setConf(Object newConf) {
   @Override
   public List<TableIdentifier> listTables(SessionContext context, Namespace 
ns) {
     checkNamespaceIsValid(ns);
+    Map<String, String> queryParams = Maps.newHashMap();
+    List<TableIdentifier> tables = Lists.newArrayList();
+    String pageToken = "";
+    if (restPageSize != null) {
+      queryParams.put("pageToken", pageToken);
+      queryParams.put("pageSize", restPageSize);
+    }
+    do {
+      ListTablesResponse response =
+          client.get(
+              paths.tables(ns),
+              queryParams,
+              ListTablesResponse.class,
+              headers(context),
+              ErrorHandlers.namespaceErrorHandler());
+      pageToken = response.nextPageToken();

Review Comment:
   I feel like there should be a test that verifies that the respective 
endpoint was called X times with the correct page token in the query params. We 
have plenty of tests in `TestRESTCatalog` that do something similar to this, so 
you could take a look at those as a reference for how to add such a test when 
doing pagination for namespaces/tables/views



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