Repository navigation
Docs: Document incremental append scans - #4524
Open
smaheshwar-pltr wants to merge 3 commits into
Open
smaheshwar-pltr wants to merge 3 commits into
smaheshwar-pltr wants to merge 3 commits into
Conversation
Add an API docs section for incremental_append_scan: a worked example, optional and inclusive range bounds, reading new rows since the last run, the shared scan arguments, and the caveat that only append snapshots are read, so it is not a changelog scan. Say the same in the scan docstrings and document the precondition of ancestors_between_ids. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cut the section down to the snapshot range and the append-only caveat, and drop the docstring rewording that isn't needed for the docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fokko
reviewed
Nov 30, 2026
| ).to_arrow() | ||
| ``` | ||
|
|
||
| Both bounds are optional. Without a start, the scan reads from the beginning of the table's history, and without an end, up to the current snapshot. The start must be an earlier snapshot in the end snapshot's history, or a `ValueError` is raised. |
Contributor
There was a problem hiding this comment.
A few things about this paragraph:
- Without a start, the scan begins at the oldest ancestor of the end snapshot that hasn't been expired, not at the start of the table's whole history. These differ after expiry or a rollback, or when
to_snapshot_id_inclusiveisn't the current snapshot. Maybe "from the end snapshot's oldest ancestor"? - The common polling pattern is to save the last snapshot you read and pass it back as
from_snapshot_id_exclusive. If nothing has been committed since, that start equals the current snapshot, and the scan raises:"Earlier snapshot" technically covers this, but a note telling readers to compare againstValueError: Starting snapshot (exclusive) … is not a parent ancestor of end snapshot …tbl.current_snapshot()first would save them a surprise. - On the other hand, the exclusive start doesn't need to exist in the metadata anymore. An expired snapshot works as long as it's the parent of a snapshot that's still there, which is worth mentioning for consumers resuming from a saved snapshot ID.
|
|
||
| Both bounds are optional. Without a start, the scan reads from the beginning of the table's history, and without an end, up to the current snapshot. The start must be an earlier snapshot in the end snapshot's history, or a `ValueError` is raised. | ||
|
|
||
| It takes the same filtering and projection arguments, and has the same output methods, as [`scan()`](#query-the-data). |
Contributor
There was a problem hiding this comment.
This isn't quite the same as scan():
count()lives onDataScan, soIncrementalAppendScandoesn't have it.- The "Query the data" section describes REST server-side scan planning (
scan-planning-mode=server). The incremental scan always plans on the client, even when the catalog or table asks for server-side planning.
Could we narrow the sentence to the methods it supports (to_arrow, to_arrow_batch_reader, to_pandas, to_duckdb, to_ray, to_polars) and mention that it's always planned on the client? Adding server-side planning support could be a follow-up, since the REST plan request already accepts a start and end snapshot.
| from_snapshot_id_exclusive=from_snapshot_id, | ||
| to_snapshot_id_inclusive=to_snapshot_id, | ||
| ).to_arrow() | ||
| ``` |
Contributor
There was a problem hiding this comment.
Nit: it might be worth mentioning the builder methods too, especially from_snapshot_id_inclusive(), since the keyword arguments only offer an exclusive start:
tbl.incremental_append_scan().from_snapshot_id_inclusive(snapshot_id).to_arrow()This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
incremental_append_scan()wasn't documented, so this adds a short section after "Query the data" that covers the snapshot range and warns that onlyappendsnapshots are read, so the scan doesn't reflect deletes or updates.I've also added a short note about this on the method's docstring.
Are these changes tested?
N/A (but
make docs-buildpasses)Are there any user-facing changes?
Docs only change.