Skip to content

[python] Support incremental-between with snapshot ids and tags - #10857

Merged
JingsongLi merged 1 commit into
apache:masterfrom
plusplusjiajia:fix/python-incremental-between-snapshots
Oct 29, 2026
Merged

JingsongLi merged 1 commit into
apache:masterfrom
plusplusjiajia:fix/python-incremental-between-snapshots

Conversation

@plusplusjiajia

Copy link
Copy Markdown
Member

Purpose

PyPaimon only recognized incremental-between-timestamp, so batch reads with incremental-between set to two snapshot ids or two tags fell back to a full read of the latest snapshot, and incremental-between-scan-mode and incremental-to-auto-tag were ignored.

As in Java AbstractDataTableScan:

  • incremental-between reads the changes between two snapshot ids or two tags, start exclusive and end inclusive, with Java's validation of the range. Tags are resolved before snapshot ids, and branch tables use their own history.
  • incremental-between-scan-mode is honored for both incremental-between and incremental-between-timestamp: delta and changelog read the delta or changelog files, and auto picks one by changelog-producer.

The diff mode, the default diff between two tags (without incremental-between-tag-to-snapshot) and incremental-to-auto-tag are not supported and now raise NotImplementedError instead of being ignored.

Code that pins a snapshot or rejects incremental scans (snapshot copies, temporal alignment, window datasets and Ray joins) now treats incremental-between and incremental-to-auto-tag like incremental-between-timestamp, and native planning leaves these reads to the Python scanner.

Tests

  • native_plan_incremental_test.py: snapshot id and tag ranges on append and primary-key tables, range validation, expired and empty histories, tag resolution order and branch history, the scan modes, and the unsupported options.
  • table_scan_mode_test.py, file_store_table_test.py, native_plan_test.py, multimodal_temporal_test.py and table_write_test.py: option validation, snapshot pinning, native fallback, temporal alignment and writes through an incremental copy.
  • 59 of the new test cases fail on master; the write test guards existing behavior. The related tests pass locally: 376 passed, with native runtime cases skipped. flake8 is clean.

As in Java AbstractDataTableScan, batch reads with incremental-between
read the changes between two snapshot ids or two tags, start exclusive
and end inclusive, with Java's validation of the range. PyPaimon only
recognized incremental-between-timestamp, so these reads fell back to a
full read of the latest snapshot.

incremental-between-scan-mode is now honored for both options: delta and
changelog read the delta or changelog files, and auto picks one by
changelog-producer, as in Java. The diff mode, the default diff between
two tags (without incremental-between-tag-to-snapshot) and
incremental-to-auto-tag are not supported and raise NotImplementedError
instead of being ignored.

Code that pins a snapshot or rejects incremental scans now treats
incremental-between and incremental-to-auto-tag like
incremental-between-timestamp.
@plusplusjiajia
plusplusjiajia marked this pull request as ready for review October 28, 2026 16:35
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit 5e5f2f4 into apache:master Oct 29, 2026
21 checks passed
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