Repository navigation
Conversation
Bind scan planning and Arrow filters to the same full schema as projection. Keep current-schema binding for deletes and unpinned partition inspection.
Use the transaction schema for both filtering and projection so schema changes do not bind upsert joins to an older branch snapshot. Share this scan behavior with deletes and cover added or replaced join columns, branch writes, staged writes, and updates after a staged schema change.
Preserve current-schema partition inspection alongside manifest-list decryption. Bind the new residual-cache filter against the scan schema so time-travel scans keep using the snapshot schema.
Preserve branch context when copying scans so schema changes do not make branch filters read old field IDs or reject renamed columns. Tags and explicit snapshot scans continue to use their historical schemas.
rich7420
marked this pull request as draft
November 10, 2026 03:07
rich7420
marked this pull request as ready for review
November 10, 2026 03:10
# Conflicts: # pyiceberg/table/__init__.py # tests/table/test_init.py
# Conflicts: # tests/table/test_inspect.py
…nd to Main's apache#4400 finds list and map columns by looking up the filter's field IDs in the current table schema. A time-travel filter is bound to the snapshot's schema, so a column dropped since then raised "Could not find field with id". Look the IDs up in the schema the filter is bound to.
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.
Closes #4138
Rationale for this change
Time-travel scans project the snapshot's schema but bind row filters to the current schema. Dropping and re-adding a same-named column therefore makes historical filters use the wrong field ID and silently return no rows.
Use the scan's full schema for file planning and Arrow filtering, including filter columns excluded from the output. Branch scans use the table's current schema for both filtering and projection, so an upsert inside a transaction sees staged schema changes. Tag scans keep the tag's snapshot schema. Partition inspection without an explicit snapshot continues to use the current schema.
Are these changes tested?
On Python 3.12, after merging main at
fef852f4,make test PYTEST_ARGS='-q --tb=short'passes with 4,890 passed, 5 skipped and 129 deselected.make lintpasses.With
pyiceberg/reverted to main, the nine historical-read regression cases fail. Removing the branch check inTableScan._scan_schemamakes eight cases fail: the two branch row-filter tests under each of the three catalogs, and both upsert tests. Restoring it makes all eight pass. The issue's standalone repro produces 50 rows withto_arrow()and a count of 50 withcount(), instead of zero. Spark/Docker integration suites were not run.Are there any user-facing changes?
Historical filters resolve names and field IDs using the snapshot's schema, matching projection. Names introduced after that snapshot raise a field lookup error. Ordinary and incremental scans retain their current-schema behavior. Branch scans now project the current schema instead of the branch head's snapshot schema. Upserts can also update matching rows after a non-key column is added in the same transaction.