Repository navigation
Conversation
Resolve manifest partition values for filter fields as well as output fields so scans with narrow projections keep matching rows. Cover name-mapped and field-ID Parquet files and falsy partition values.
sungwy
approved these changes
Oct 6, 2026
| """Apply Column Projection rules to File Schema.""" | ||
| project_schema_diff = projected_schema.field_ids.difference(file_project_field_ids) | ||
| """Resolve missing identity partition values for output and filter columns.""" | ||
| project_schema_diff = projected_field_ids.difference(file_project_field_ids) |
Collaborator
There was a problem hiding this comment.
nit: since this is no longer derived from the projected schema, maybe rename to match the new param?
Suggested change
| project_schema_diff = projected_field_ids.difference(file_project_field_ids) | |
| missing_field_ids = projected_field_ids.difference(file_project_field_ids) |
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
When an identity partition column is absent from a Parquet file and excluded from
selected_fields, filtering on that column can return an empty result even when its manifest partition value matches the predicate.For example, a file containing
other_field = ["foo", "bar", "baz"]with manifest partitionpartition_id = 1should return all three rows for:Resolve missing identity partition values using the existing union of output and filter field IDs before translating the Arrow filter.
Are these changes tested?
The existing identity partition projection tests now cover name-mapped Parquet files and files written by PyIceberg with embedded field IDs, one and multiple partitions, mixed partition/data predicates, partial projections, and zero, empty-string, and null partition values. Six regression cases fail on the original code; all seven focused cases pass with the fix.
Validation on Python 3.13.11 and PyArrow 25.0.1:
make test PYTEST_ARGS="-q --tb=short": 4,253 passed, 7 skipped, 126 deselected.make lint: all repository-wide hooks passed.git diff --check: passed.Are there any user-facing changes?
Yes. Scans that filter on identity partition columns omitted from both the physical file and the output projection now return the matching rows while preserving the requested output columns.
AI assistance: OpenAI Codex assisted with investigation, implementation, and local validation.