eric-maynard commented on code in PR #273:
URL: https://github.com/apache/polaris/pull/273#discussion_r2021924319


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/pagination/PageToken.java:
##########
@@ -0,0 +1,179 @@
+/*
+ * 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.polaris.core.persistence.pagination;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Represents a page token that can be used by operations like `listTables`. 
Clients that specify a
+ * `pageSize` (or a `pageToken`) may receive a `next-page-token` in the 
response, the content of
+ * which is a serialized PageToken.
+ *
+ * <p>By providing that in the next query's `pageToken`, the client can resume 
listing where they
+ * left off. If the client provides a `pageToken` or `pageSize` but 
`next-page-token` is null in the
+ * response, that means there is no more data to read.
+ */
+public abstract class PageToken {
+
+  public int pageSize;

Review Comment:
   It's mostly just convenient to pass them around together. It minimizes API 
changes as you always need one if you need the other. It's also ergonomic to be 
able to do like `pageTokenBuilder.fromLimit` and then treat that just as you 
would a page token that you got from a client.
   
   That said, `PageToken` is a bit misleading. It's more like a 
`PageRequestDescriptor` or something; I'm very open to changing the name and 
just reached for `PageToken` as the most obvious choice.
   
   > Also, page size may be restricted by the total serialized size, not just 
by the number of items.
   
   Yeah the Iceberg spec just states:
   > an upper bound of the number of results that a client will receive
   
   So I think `int pageSize` captures this, but in theory you could have 
different PageToken implementations that treat this differently. For example 
you could have `EntityIdPageTokenWithBytesLimit`. So far, everything is just on 
entity count so I didn't canonicalize this into the type structure but I think 
refactoring it would make sense if we ever want such a `PageToken` (name 
pending)



-- 
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...@polaris.apache.org

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

Reply via email to