Repository navigation
Fix filtering on identity partition columns outside the scan projection - #4082
Merged
kevinjqliu merged 3 commits intoOct 24, 2026
Merged
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
Collaborator
|
I ran into another bug with this code while reviewing your code. Feel free to review it if you can. #4083 |
…tion column Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kevinjqliu
approved these changes
Oct 24, 2026
kevinjqliu
left a comment
Contributor
There was a problem hiding this comment.
LGTM!
I push a small nit fix for _get_column_projection_values's inline comment and added a test using count() (cb01c5f)
Comment on lines
-1327
to
-1328
| # TODO: Update to use a data file created by writing data to an unpartitioned table once add_files supports field IDs. | ||
| # (context: https://github.com/apache/iceberg-python/pull/1443#discussion_r1901374875) |
Contributor
There was a problem hiding this comment.
this comment is outdated and can be removed, 👍
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.