Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pagination for list APIs #273

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

eric-maynard
Copy link
Contributor

@eric-maynard eric-maynard commented Sep 6, 2024

Description

The Apache Iceberg REST catalog spec describes how APIs like listNamespaces can implement pagination, but Polaris currently does not implement pagination.

This PR implements pagination for listNamespaces, listViews, and listTables. It also introduces a framework that could be used to implement pagination for other APIs like listCatalogs.

Fixes #147

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Added tests in BasePolarisCatalogTest.

Manual testing confirms that the page-size limit applies, and that page tokens can be used to continue a listing operation:

  curl -X GET "http://localhost:8181/api/catalog/v1/quickstart_catalog/namespaces" \
     -H "Authorization: Bearer principal:root;realm:default-realm" \
     -H "Content-Type: application/json" \
     && echo
{"namespaces":[["ns1"],["ns2"],["ns3"]],"next-page-token":null}

. . .

curl -X GET "http://localhost:8181/api/catalog/v1/quickstart_catalog/namespaces" \
     -H "Authorization: Bearer principal:root;realm:default-realm" \
     -H "Content-Type: application/json" \
     --get \
     --data "pageSize=1" \
     && echo
{"namespaces":[["ns1"]],"next-page-token":"cG9sYXJpczoxOjE="}

. . .

curl -X GET "http://localhost:8181/api/catalog/v1/quickstart_catalog/namespaces" \
     -H "Authorization: Bearer principal:root;realm:default-realm" \
     -H "Content-Type: application/json" \
     --get \
     --data "pageToken=cG9sYXJpczoxOjE=" \
     --data "pageSize=1" \
     && echo
{"namespaces":[["ns2"]],"next-page-token":"cG9sYXJpczoyOjE="}

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • If adding new functionality, I have discussed my implementation with the community using the linked GitHub issue

Copy link

@dbosco dbosco left a comment

Choose a reason for hiding this comment

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

I can't resolve my own feedback. Can you close them? Thanks

@dbosco
Copy link

dbosco commented Sep 30, 2024

@eric-maynard let me know if you need any further help on this PR.

Copy link

github-actions bot commented Dec 5, 2024

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Dec 5, 2024
@eric-maynard eric-maynard removed the Stale label Dec 5, 2024
@flyrain flyrain added this to the 1.0.0 milestone Dec 19, 2024
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.

[BUG]Pagination is not working for List namespaces
3 participants