Skip to content

Reject an unpaged listing that does not fit the configured maximum - #5553

Merged
flyrain merged 2 commits into
apache:mainfrom
ayushtkn:listRejectOnOverflow
Sep 24, 2026
Merged

flyrain merged 2 commits into
apache:mainfrom
ayushtkn:listRejectOnOverflow

Conversation

@ayushtkn

Copy link
Copy Markdown
Member

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.

Checklist

  • 🛡️ Don't disclose security issues! (contact [email protected])
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Copilot AI lite review requested due to automatic review settings September 19, 2026 13:27
@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Sep 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Open (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.

flyrain
flyrain previously approved these changes Sep 21, 2026

@flyrain flyrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Thanks @ayushtkn !

Function<R, @Nullable String> nextPageToken) {
PageToken pageRequest =
PageToken.build(pageToken, pageSize, maxPageSize(), this::shouldDecodeToken);
return checkedListing(pageToken, pageSize, () -> listing.apply(pageRequest), nextPageToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Sep 21, 2026
flyrain
flyrain previously approved these changes Sep 22, 2026
@flyingImer flyingImer mentioned this pull request Sep 22, 2026
6 tasks done
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.
@ayushtkn

Copy link
Copy Markdown
Member Author

Had to rebase, due to a conflict in CHANGELOG, rest all stays as is

@flyrain
flyrain requested review from adutra and dimas-b September 23, 2026 18:02

@dimas-b dimas-b left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ayushtkn !

@flyrain
flyrain merged commit b900a3f into apache:main Sep 24, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants