INFO-studio opened a new pull request, #3833: URL: https://github.com/apache/iceberg-rust/pull/3833
## Which issue does this PR close? - Closes #3124. ## What changes are included in this PR? When binding `IS NULL` and `IS NOT NULL` predicates, `Predicate::bind` previously checked only `bound_expr.term.field().required`. A required field nested inside an optional struct (at any depth) can still evaluate to `null` when an ancestor struct is `null`, so folding `IS NULL` to `AlwaysFalse` or `IS NOT NULL` to `AlwaysTrue` dropped matching rows. Matching Apache Iceberg Java (apache/iceberg#14270): - Retain the existing `index_parents` map on `Schema` during `SchemaBuilder::build` (no public API changes) and expose a crate-internal `Schema::all_ancestors_required(field_id)` check. - Fold `IS NULL` / `IS NOT NULL` in `Predicate::bind` only when both the leaf field and all of its ancestors are required. - Return `Ok(None)` from `StructAccessor::get` when a parent struct value is `None` instead of returning `ErrorKind::Unexpected`, allowing `ExpressionEvaluator` to evaluate nested `IS NULL` / `IS NOT NULL` predicates when an ancestor struct is null. ## Are these changes tested? - Added unit test `expr::predicate::tests::test_bind_is_null_and_not_null_nested_required_fields` covering 1- and 2-level nested required fields under optional and required structs. - Added unit test `expr::accessor::tests::test_nested_accessor_null_parent_struct` verifying `StructAccessor::get` returns `Ok(None)` when the parent struct is `None`. - Ran `cargo fmt --all -- --check`, `cargo test -p iceberg --lib expr::` (380 passed), `spec::` (627 passed), `arrow::` (407 passed), and `cargo clippy -p iceberg --lib --tests -- -D warnings`. ## AI Disclosure AI assistance was used to analyze the issue against apache/iceberg#14270, implement the fix and tests, and run local verification. Areas for reviewer attention: - Confirming that `Schema` keeping `id_to_parent` (reusing the `index_parents` call already done in `SchemaBuilder::build`) is preferred over recomputing ancestors per `Predicate::bind`. - Confirming that `StructAccessor::get` returning `Ok(None)` for a `None` parent struct matches expectations across all `StructAccessor` callers. -- 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]
