Core: Select inspect.partitions snapshot metadata by commit time#3706
Open
fallintoplace wants to merge 1 commit into
Open
Core: Select inspect.partitions snapshot metadata by commit time#3706fallintoplace wants to merge 1 commit into
fallintoplace wants to merge 1 commit into
Conversation
fallintoplace
force-pushed
the
fix/partitions-last-updated-snapshot
branch
from
July 25, 2026 15:36
9505c52 to
a87a2e2
Compare
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
InspectTable.partitions()aggregates files by partition and records the snapshot that most recently updated each partition. Its update condition comparedlast_updated_snapshot_idwith the next snapshot'stimestamp_ms. Snapshot IDs are identifiers, not commit-order values, so comparing these unrelated fields made the reported metadata depend on manifest-entry order.This change follows Apache Iceberg Java's
PartitionsTablebehavior: compare the currentlast_updated_atwith the snapshot commit timestamp, then updatespec_id,last_updated_at, andlast_updated_snapshot_idtogether when the incoming snapshot is newer.Are these changes tested?
Yes. A parametrized regression test processes the same snapshots in both possible orders. The snapshot IDs deliberately decrease while commit timestamps increase, verifying that commit time alone selects the latest
spec_id, timestamp, and snapshot ID.The following checks pass locally:
PYTHONPATH=. uv run pytest tests/table/test_inspect.py -q(6 passed)PYTHONPATH=. uv run pytest tests/io/test_pyarrow.py -k "inspect_partition" -q(2 passed)PYTHONPATH=. uv run --extra datafusion --extra pyiceberg-core pytest tests/table -q(329 passed)make lintAre there any user-facing changes?
Yes.
table.inspect.partitions()now reports the latestspec_id,last_updated_at, andlast_updated_snapshot_idfor each partition independently of manifest-entry order. There are no API changes.