Repository navigation
Reject an unpaged listing that does not fit the configured maximum - #5553
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The federated regression test and broader endpoint coverage need updates, and CLI documentation must reflect the new behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
This PR rejects oversized unpaged listings instead of silently truncating them, while preserving explicit pagination behavior.
Changes:
- Centralizes pagination checks across Iceberg, generic-table, and semantic-model listings.
- Updates tests, configuration documentation, Javadocs, and the changelog.
- Preserves existing behavior when pagination is disabled or uncapped.
| File | Reviewed changes |
|---|---|
site/content/in-dev/unreleased/configuration/config-sections/flags-polaris_features.md |
Documents oversized unpaged listing rejection. Nit (1 vote): Update Python CLI documentation/help or make the CLI opt into pagination. |
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandlerTest.java |
Adds local pagination behavior tests. |
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java |
Routes Iceberg listings through shared pagination handling. |
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java |
Exposes the initial pagination token. |
runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/GenericTableCatalogHandler.java |
Applies shared pagination handling to generic-table listings. |
runtime/service/src/main/java/org/apache/polaris/service/catalog/common/CatalogHandler.java |
Adds centralized bounded-listing and rejection logic. Critical (2 votes): Update the federated integration test for the new rejection behavior. Moderate (1 vote): Add coverage for federated, generic-table, semantic-model, and pagination-disabled paths. |
polaris-core/src/main/java/org/apache/polaris/core/persistence/pagination/PageToken.java |
Updates pagination-token documentation. |
polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java |
Updates feature configuration documentation. |
extensions/semantic-models/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogHandler.java |
Applies shared pagination handling to semantic-model listings. |
CHANGELOG.md |
Records the changed listing behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6ce71a8 to
bc399bc
Compare
| Function<R, @Nullable String> nextPageToken) { | ||
| PageToken pageRequest = | ||
| PageToken.build(pageToken, pageSize, maxPageSize(), this::shouldDecodeToken); | ||
| return checkedListing(pageToken, pageSize, () -> listing.apply(pageRequest), nextPageToken); |
There was a problem hiding this comment.
Non-blocking: I'm fine with rejecting an unpaged request when the result exceeds the configured limit. Could we keep the existing listing calls and invoke a shared rejectIncompleteListing(...) helper after obtaining each result? That would preserve the check across all listing APIs with less refactoring; the extra callback layers in paginatedListing, federatedListing, and checkedListing make this small behavior change harder to follow, they are not strictly needed.
LIST_PAGINATION_MAX_PAGE_SIZE truncated a request that supplied neither pageToken nor pageSize and answered it with a continuation token. The Iceberg REST specification requires such a request to receive the complete result with a null next-page-token, so a client that does not follow continuations silently saw only the first page. Such a request is now rejected when the result does not fit. An empty pageToken starts a paginated listing and is still capped, so clients that page - including the Iceberg Java client, which always sends pageToken= and follows next-page-token - are unaffected. A maximum of zero or less, the default, leaves everything unchanged, and LIST_PAGINATION_ENABLED=false still ignores pagination parameters entirely.
…pers The listing calls keep their original shape and invoke the shared check on the result, rather than passing the listing in as a callback. The three wrapper methods are gone; CatalogHandler now holds only shouldDecodeToken, maxPageSize and rejectIncompleteListing, which is what the listing handlers had three private copies of. The federated bounding moves back beside its only callers in IcebergCatalogHandler, so CatalogHandlerUtils.INITIAL_PAGE_TOKEN goes back to package-private.
dbf5a8b to
0e5c7ab
Compare
|
Had to rebase, due to a conflict in CHANGELOG, rest all stays as is |

LIST_PAGINATION_MAX_PAGE_SIZEtruncated a request that supplied neitherpageTokennorpageSizeand answered it with a continuation token. The Iceberg REST specification requires such a request to receive the complete result with anullnext-page-token, so a client that does not follow continuations silently saw only the first page.Such a request is now rejected when the result does not fit. An empty
pageTokenstarts a paginated listing and is still capped, so clients that page - including the Iceberg Java client, which always sendspageToken=and followsnext-page-token- are unaffected. A maximum of zero or less, the default, leaves everything unchanged, andLIST_PAGINATION_ENABLED=falsestill ignores pagination parameters entirely.Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)