LuciferYang opened a new pull request, #3306: URL: https://github.com/apache/iceberg-rust/pull/3306
## What `Predicate::bind` rewrites `IS NULL` on a required field to `AlwaysFalse` (and `IS NOT NULL` to `AlwaysTrue`) from the leaf field's own `required` flag, without checking whether an ancestor struct is optional. The spec says a null parent struct implies its leaves are null, so the shortcut is only valid when the field and every ancestor are required. With `person` optional and `person.age` required, `person.age IS NULL` bound to `AlwaysFalse`, so a scan dropped the rows whose `person` is null instead of keeping them. `IS NOT NULL` had the mirror bug: it bound to `AlwaysTrue` and kept those rows. Closes #3292. ## How Added `Schema::is_field_and_ancestors_required(field_id)`, which walks the parent chain and returns true only when the leaf and every ancestor struct is required. The parent chain comes from the existing `index_parents`, now computed once in `build()` and stored on `Schema`; `validate_identifier_ids` takes that shared map instead of recomputing its own. The two `Unary` arms in `Predicate::bind` use this check in place of the leaf-only `required` flag. ## Tests - `test_bind_is_null_required_leaf_under_optional_parent_is_kept` and its `is_not_null` sibling: a required leaf under an optional parent keeps the predicate instead of folding to a constant. - `test_bind_null_predicates_on_leaf_under_required_parent_short_circuit`: a fully required path still folds to `False` / `True`. - `test_bind_is_null_required_leaf_under_optional_grandparent_is_kept`: an optional struct two levels up is caught by the ancestor walk. - `test_is_field_and_ancestors_required`: helper coverage for top-level fields and an unknown id. End-to-end reads of a null parent through the Arrow row filter depend on #2906 (nested-leaf predicate pushdown); this PR fixes the binding layer, which is reachable and testable on its own. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
