Interface PaginatedScan

All Superinterfaces:
Scan
All Known Implementing Classes:
PaginatedScanImpl

public interface PaginatedScan extends Scan
Extension of Scan that supports pagination.

This interface allows consumers to retrieve scan results in discrete, ordered pages rather than all at once. This is particularly useful for large datasets where materializing the full result set would be expensive in terms of memory or compute resources.

Pagination is achieved via a combination of pageSize and pageToken. The pageSize controls how many Scan files are returned in each page, while the pageToken encodes the location of next batch to read and is used to resume the scan from exactly where the last page ended. For the first page, the pageToken should be Optional.empty().

Consumers typically use PaginatedScan in a loop: they call getScanFiles() to retrieve an iterator over the current page's scan files. After consuming the iterator, users should call PaginatedScanFilesIterator.getCurrentPageToken() to retrieve a token to pass into the next page request. This allows users to scan the dataset incrementally, resuming from where they left off.