Skip to content

Project identity partition values into required columns missing from the data file - #4268

Open
slachiewicz wants to merge 2 commits into
apache:mainfrom
slachiewicz:fix-required-identity-projection
Open

slachiewicz wants to merge 2 commits into
apache:mainfrom
slachiewicz:fix-required-identity-projection

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Closes #4267

Rationale for this change

The spec's column projection rules fill a field that is missing from a data file from the identity partition value in the manifest. ArrowProjectionVisitor.struct applied that rule only inside the branch for optional fields and fields with an initial-default, so a required identity partition column raised ResolveError instead. Tables whose writers keep partition columns out of the data files, such as Hive-style layouts and tables converted from Delta, hit this on every read.

A required field now takes the projected value. A null partition value raises ResolveError for a required field, even when the field has an initial-default, unless the field's parent struct is null in every row.

Are these changes tested?

Yes. test_identity_transform_column_projection_required_field covers the projected value, the column's non-nullable type and row filters on it, with and without an initial-default, plus the null partition value. test_identity_transform_column_projection_required_field_under_null_parent covers a required child of an optional struct. Both fail without the change.

Are there any user-facing changes?

Scans of such tables return the partition value instead of raising ResolveError.

…the data file

Column projection filled a missing identity partition column only when the field was optional, so a required one raised ResolveError even though the manifest carries its value. Closes apache#4267.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Null partition handling remains incorrect for required fields with defaults and for required children masked by null optional parents.

2 open issues
What changed in this PR

This PR addresses #4267 by allowing PyIceberg scans to populate required columns omitted from data files using non-null identity partition values.

Changes:

  • Extends Arrow projection eligibility to required fields with non-null partition values.
  • Adds regression coverage for projected values, non-nullable output, row filtering, and null rejection without a default.
File Description
tests/​io/​test_pyarrow.py Adds required identity partition column projection tests.
pyiceberg/​io/​pyarrow.py Allows non-null partition values to populate missing required fields.

Review effort: Balanced

Comment thread pyiceberg/io/pyarrow.py Resolved
Comment thread pyiceberg/io/pyarrow.py Resolved
…s parent is null

A null projected value no longer reaches a required field through its initial-default, and it fills a required child of an optional struct when that struct is null in every row.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scan raises ResolveError for a required identity-partition column that is not in the data file

2 participants