Teach row group pruning about struct field predicates#21003
Open
friendlymatthew wants to merge 1 commit intoapache:mainfrom
Open
Teach row group pruning about struct field predicates#21003friendlymatthew wants to merge 1 commit intoapache:mainfrom
friendlymatthew wants to merge 1 commit intoapache:mainfrom
Conversation
friendlymatthew
commented
Mar 17, 2026
Contributor
Author
friendlymatthew
left a comment
There was a problem hiding this comment.
self review
Comment on lines
+55
to
+71
| impl From<Column> for PruningColumn { | ||
| fn from(column: Column) -> Self { | ||
| Self { | ||
| column, | ||
| field_path: vec![], | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl From<&Column> for PruningColumn { | ||
| fn from(column: &Column) -> Self { | ||
| Self { | ||
| column: column.clone(), | ||
| field_path: vec![], | ||
| } | ||
| } | ||
| } |
Contributor
Author
There was a problem hiding this comment.
As you can see from the diff of this PR, it introduces a lot of the same breaking change where we once accepted a Column and now require a PruningColumn
Hopefully these convenience methods help
Comment on lines
+624
to
+628
| return Ok(StatisticsConverter::from_column_index( | ||
| leaf_idx, | ||
| arrow_field, | ||
| self.parquet_schema, | ||
| )?); |
Contributor
Author
There was a problem hiding this comment.
7873e80 to
55ef323
Compare
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?
Rationale for this change
This PR enables Parquet row group pruning for predicates on struct fields like
WHERE s['value']> 5Previously, the pruning predicate system only understood top level column references. When it encountered a struct field access via
get_field, it marked the expression as unhandled and conservatively kept every row group, even though Parquet stores valid min/max stats for each leaf column in the file metadata. This meant queries filtering on struct fields always read all row groups, missing a significant optimization opportunity on struct heavy tables (like Variant!)This optimization introduces
PruningColumnwhich wraps aColumnthat carries an optional field path for nested struct access. The pruning expression builder now recognizesget_Fieldexpressions, extracts the field path, and threads it through the statistics lookup pipelineOn the Parquet side,
RowGroupPruningStatisticsresolves the field path to the corresponding leaf column index in the Parquet schema and uses apache/arrow-rs#9540 to fetch the correct row group stats