Repository navigation
fix(expressions): bound ancestor nullability in IsNull/NotNull binding - #4068
dominikandreasseitz wants to merge 1 commit into
Conversation
|
@Fokko @kevinjqliu first time contributing, please let me know if any amendments are needed. Thank you! |
00a5a0e to
b76908b
Compare
… nested fields BoundIsNull/BoundNotNull folded to AlwaysFalse()/AlwaysTrue() at bind time using only a field's own required flag. A required leaf field can still be absent from a row if an optional ancestor struct containing it is null, so plan_files() was silently dropping matching files once IsNull/NotNull hit a required field under an optional parent. Add Schema.is_field_required_in_path to walk the existing ancestor index and check the full path, and move the fold from BoundIsNull/BoundNotNull.__new__ into IsNull.bind()/NotNull.bind(), where the schema is already in scope. BoundReference and all other public signatures are unchanged. This mirrors Java's fix for the same bug (apache/iceberg#14270), which similarly reverted an earlier attempt to carry ancestor-nullability on the Accessor/BoundTerm itself (apache/iceberg#13804) in favor of a schema-level ancestor walk done only at bind time.
b76908b to
d715afe
Compare
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Closes #4067
Description
Fixes
IsNull/NotNullbinding silently dropping rows/files for a required field nested under an optional ancestor struct.Related iceberg java/rust PRs:
Bug:
BoundIsNull/BoundNotNull.__new__folded toAlwaysFalse()/AlwaysTrue()using only a field's ownrequiredflag.requiredleaf can still be absent if an optional ancestor struct containing it is nullplan_files()silently dropped matching files onceIsNull/NotNullhit a required field under an optional parent.Example:
New behavior:
IsNull/NotNullon a required field nested under an optional ancestor now correctly matches rows/files instead of silently pruning them.Change
pyiceberg/schema.py— addSchema.is_field_required_in_path(field_id), which walks the existing ancestor index to check the field and every ancestor is required. Mirrors Java'sTypeUtil.ancestorFields/allAncestorFieldsAreRequired.pyiceberg/expressions/__init__.py— remove the leaf-only fold fromBoundIsNull/BoundNotNull.__new__; do the fold inIsNull.bind()/NotNull.bind()instead, matching where Java does it (UnboundPredicate.bindUnaryOperation) — no change toBoundReference.tests/test_schema.py,tests/expressions/test_expressions.py— coverage for the fix.