Skip to content

Commit b27860a

Browse files
Fix Paginator dropping results on empty token pages (#818)
## Summary Fix `Paginator` silently dropping results when a token-paginated response returns an empty page that still carries a `next_page_token`. Adds explicit `newTokenPagination` / `newOffsetPagination` factories and regenerates all list methods to use them. Backward compatible — the existing constructor is kept and deprecated. ## Why Token-paginated endpoints (e.g. `tables().list()`) may return empty intermediate pages with a valid `next_page_token` — the only reliable end-of-results signal is the token's absence. `Paginator` stopped at the first empty page, so these calls under-returned results. Offset/limit APIs (SCIM, legacy SQL) have no token and *do* end on an empty page, so the fix is strategy-aware (a blanket "skip empty pages" would loop those forever). ## What changed - `Paginator.newTokenPagination(...)` — page until `nextPageFn` returns null; empty pages are skipped. - `Paginator.newOffsetPagination(...)` — stop on the first empty page (previous behavior). - The existing `Paginator` constructor is **kept and `@Deprecated`**, retaining its prior offset/limit behavior — no breaking change. - Regenerated `*API.java` (91 token / 34 offset). Hand-written: `SharesExtAPI` → token; SCIM `Users`/`Groups`/`ServicePrincipals` + `Account*` → offset. ## How is this tested? - `PaginatorTest`: token pagination walks past empty leading/intermediate pages; offset pagination still stops on the first empty page. - `mvn clean compile` over the full regenerated SDK (3,902 sources) passes. Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
1 parent 6c3ad50 commit b27860a

125 files changed

Lines changed: 374 additions & 180 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEXT_CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44

55
### New Features and Improvements
66

7+
* Added `Paginator.newTokenPagination(...)` and `Paginator.newOffsetPagination(...)` factory methods in `com.databricks.sdk.support`, which make the pagination strategy explicit. The `Paginator` constructor is now deprecated in favor of these; it keeps its previous (offset/limit) behavior.
8+
79
### Breaking Changes
810

911
### Bug Fixes
1012

13+
* Fixed `Paginator` silently dropping results when a token-paginated response returned an empty page with a non-empty `next_page_token`. List methods (e.g. `tables().list()`) now keep paging until the page token is absent instead of stopping at the first empty page.
14+
1115
### Security Vulnerabilities
1216

1317
### Documentation

databricks-sdk-java/src/main/java/com/databricks/sdk/service/apps/AppsAPI.java

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/apps/AppsSettingsAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/billing/BudgetPolicyAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/billing/BudgetsAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/billing/LogDeliveryAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/bundle/BundleAPI.java

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountMetastoreAssignmentsAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountMetastoresAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountStorageCredentialsAPI.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)