Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Filter-only partition columns still fall back to the initial default when excluded from the output projection.
Review effort: Balanced
Findings: 1
What changed in this PR
Fixes null identity partition projection so it takes precedence over a field’s initial default.
Changes:
- Preserves explicit null partition values during projection and filtering.
- Adds regression coverage for null projection and predicates.
| File | Description |
|---|---|
pyiceberg/io/pyarrow.py |
Distinguishes explicit null projections from absent values. |
tests/io/test_pyarrow.py |
Tests null identity partitions with initial defaults. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| partition_value = accessors[partition_field.field_id].get(file.partition) | ||
| if partition_value is not None: | ||
| projected_missing_fields[field_id] = partition_value | ||
| projected_missing_fields[field_id] = accessors[partition_field.field_id].get(file.partition) |
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
The spec's Column Projection rules say that when a field isn't present in a data file, we resolve its value in order:
Today _get_column_projection_values only records the identity partition value when it's non-null. So when a file's partition value is null, we skip rule 1 and fall through to rule 3, as if the partition metadata had nothing to say. This was harmless before v3 because initial-default was always null anyway, but with a non-null initial-default we now read the default instead of null.
This came up while reviewing #4082
Are these changes tested?
Yes
Are there any user-facing changes?
Only for v3 tables with a non-null initial-default on an identity-partitioned column on null partition. This is a bug fix that conforms to the spec: https://iceberg.apache.org/spec/#column-projection