danielcweeks commented on code in PR #9782: URL: https://github.com/apache/iceberg/pull/9782#discussion_r1545017898
########## core/src/main/java/org/apache/iceberg/rest/PaginatedList.java: ########## @@ -0,0 +1,269 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.rest; + +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.function.Supplier; +import org.apache.iceberg.catalog.Namespace; +import org.apache.iceberg.exceptions.ValidationException; +import org.apache.iceberg.relocated.com.google.common.collect.Lists; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.apache.iceberg.rest.responses.ListNamespacesResponse; +import org.apache.iceberg.rest.responses.ListTablesResponse; +import org.apache.iceberg.rest.responses.Route; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PaginatedList<T> implements List<T> { Review Comment: I have some concerns about the way we're implementing the pagination. It doesn't appear like we're properly adhering to the List interface behavior. For example, if we perform a `namespaces = catalog.listNamespaces(...)` and then check `namespaces.size()` we would get zero even if there are results. Other methods like `contains` would appear to not have the right behavior either. Overall, it seems like we're trying to hide the pagination behind the List interface but not really getting the behavior we want. We might want to consider just prefetching as it seems the primary limitation is expected to be on the server side (client will likely need to fit the whole result in memory anyway). That may simplify this and not require the paginated list implementation. -- 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