Stephen0421 opened a new pull request, #8817:
URL: https://github.com/apache/paimon/pull/8817
### Purpose
JdbcCatalog.listViewsPaged previously returned all views in a single page
and ignored paging/pattern parameters. This PR implements the real behavior:
- Cursor-based paging via an exclusive cursor (view_name > ?) ordered by
view_name. The previous page's last name is returned as the opaque
nextPageToken; the next request resumes strictly after it. LIMIT
maxResults + 1 is fetched so the existence of a next page is detected
without a separate count.
- Pattern filtering pushed down to SQL LIKE (view_name LIKE ?).
- maxResults == null or 0 means "no paging" — all matching views are
returned with no next page; a negative value is rejected.
- null or empty viewNamePattern means "no pattern" — all views are
returned (per the Catalog contract, which says "if not set or empty").
- System databases return an empty page; a non-existent database throws
DatabaseNotExistException.
- listViewDetailsPaged reuses the paged name list and resolves each view
via getView, mirroring the existing listTableDetailsPagedImpl pattern in
AbstractCatalog.
Design notes:
- The view table's primary key is (catalog_key, view_database, view_name),
so view_name is unique per database — the exclusive cursor is stable (no
dropped/duplicated rows across pages).
- CatalogUtils.validateNamePattern is intentionally not called here: this
method supports LIKE directly. supportsListByPattern() remains false so that
listTablesPaged/listDatabasesPaged (which still use the
all-objects fallback) continue to throw UnsupportedOperationException on a
pattern rather than silently returning unfiltered results. The Catalog javadoc
for supportsListByPattern() is updated to document
that a single method may honor a pattern by overriding it directly,
independent of the flag.
- The listViewsPaged/listViewDetailsPaged javadoc is relaxed: pattern
semantics (full LIKE vs prefix-only) is now stated as catalog-specific,
matching the real JdbcCatalog behavior.
### Tests
Added testListViewsPaged and testListViewDetailsPaged to JdbcCatalogTest
covering:
- Empty database → empty page, no next token.
- maxResults == null, 0, and larger than the full set → all views, no next
page.
- Empty pattern → all views.
- Full paging walk with maxResults = 2 (next-page token is the last name of
each page; final page has no token).
- pageToken resumes strictly after the token value.
- Negative maxResults → IllegalArgumentException.
- DatabaseNotExistException for a missing database.
- LIKE patterns: view%, view_, _bd, zzz% (empty result).
- Pattern combined with paging.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]