fix(arrow): allow predicates on struct-nested leaf columns - #2906
Open
LuciferYang wants to merge 1 commit into
Open
fix(arrow): allow predicates on struct-nested leaf columns#2906LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
A predicate on a primitive leaf inside a struct (e.g. `person.age > 25`) failed while building the Arrow row filter with "Leaf column ... isn't a root column in Parquet schema". `PredicateConverter::bound_reference` resolved the field to its Parquet leaf index and rejected it when that leaf's column root was a group, and `project_column` only handled top-level columns. Resolve the referenced field to its Parquet column path (root to leaf) instead of a single leaf index, and have `project_column` walk that path through the projected `RecordBatch`, descending `StructArray` children by name to reach the primitive leaf. `ProjectionMask::leaves` preserves the Parquet nesting, so a predicate on `nested.value` sees `nested` as a `StructArray` holding the leaf. Only top-level and struct-nested primitive leaves can bind a predicate (list/map interiors have no accessor), so every path segment before the leaf is a struct. Tested: unit coverage for the nested-leaf conversion, plus end-to-end reads of real Parquet files for single- and double-nested struct leaves, and a bind-time check that predicates on list/map interior fields are rejected before reaching the row filter. Closes apache#2432
mbutrovich
self-requested a review
July 27, 2026 20:56
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.
Which issue does this PR close?
What changes are included in this PR?
A predicate on a primitive leaf inside a struct (e.g.
person.age > 25) fails while building the Arrow row filter withLeaf column ... isn't a root column in Parquet schema.PredicateConverter::bound_referenceresolved the field to its Parquet leaf index and rejected it when that leaf's column root was a group, andproject_columnonly handled top-level columns.This resolves the referenced field to its Parquet column path (root to leaf) instead of a single leaf index, and has
project_columnwalk that path through the projectedRecordBatch, descendingStructArraychildren by name to reach the primitive leaf.ProjectionMask::leavespreserves the Parquet nesting, so a predicate onnested.valueseesnestedas aStructArrayholding the leaf.Scope
Only top-level and struct-nested primitive leaves can carry a predicate:
Schema::build_accessorsbuilds no accessor for list/map interior fields, soReference::bindrejects them before the row filter is ever built. Every path segment before the leaf is therefore a struct. This matches the Java reader, which reads a struct-nested field normally.Row-group and page-index pruning (
RowGroupMetricsEvaluator/PageIndexEvaluator) resolve nested leaves by field id and never errored on this path; they are out of scope here and can be looked at separately.Are these changes tested?
predicate_visitor: unit coverage for the nested-leaf conversion (agroup person { int32 age }Parquet schema, the shape that used to be rejected).row_filter: end-to-end reads of real Parquet files for a single-nested (person.age) and a double-nested (person.address.zip) struct leaf, so the projectedRecordBatchshape comes from arrow-rs rather than a hand-built batch; and a bind-time check that predicates on list-element and map-value fields are rejected before reaching the row filter.All three predicate tests fail on the pre-fix code and pass after.
cargo test -p iceberg --lib,cargo fmt --check, andcargo clippy --all-targets --all-features -- -D warningsall pass. No public API signature changes.