Skip to content

Docs: Document incremental append scans - #4524

Open
smaheshwar-pltr wants to merge 3 commits into
apache:mainfrom
smaheshwar-pltr:sm/ias-docs
Open

smaheshwar-pltr wants to merge 3 commits into
apache:mainfrom
smaheshwar-pltr:sm/ias-docs

Conversation

@smaheshwar-pltr

Copy link
Copy Markdown
Contributor

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 only append snapshots 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-build passes)

Are there any user-facing changes?

Docs only change.

smaheshwar-pltr and others added 3 commits November 21, 2026 12:45
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]>
Comment thread mkdocs/docs/api.md
).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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_inclusive isn'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:
    ValueError: Starting snapshot (exclusive) … is not a parent ancestor of end snapshot …
    
    "Earlier snapshot" technically covers this, but a note telling readers to compare against 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.

Comment thread mkdocs/docs/api.md

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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't quite the same as scan():

  • count() lives on DataScan, so IncrementalAppendScan doesn'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.

Comment thread mkdocs/docs/api.md
from_snapshot_id_exclusive=from_snapshot_id,
to_snapshot_id_inclusive=to_snapshot_id,
).to_arrow()
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

No deployments
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.

2 participants