Repository navigation
Conversation
4793006 to
68509e0
Compare
68509e0 to
866bb35
Compare
| /// Only struct paths are supported. A path through a map is a runtime key | ||
| /// lookup, and a field below a list has statistics per element, not per row. | ||
| #[derive(Debug, Default)] | ||
| pub(crate) struct GetFieldStatisticsResolver; |
There was a problem hiding this comment.
The fake Variant resolver has to match its function by name and restate which leaves it reads. With #26282, a single built-in resolver could cover any function with the NestedInputAccess capability: bind gets the leaves from required_fields (which is called with each file's physical schema, so per-file shredding works), and statistics calls output_statistics. get_field would go through the same path with no GetFieldFunc downcast, and a function author would get pruning and narrowed reads from one implementation. The resolver trait would stay for the format-specific cases, like binding a cast to a sidecar leaf. It feels like this PR and #26282 fit together well: this one gives output_statistics a general place to be called from, and that one would no longer need its placeholder-column rewrite.
There was a problem hiding this comment.
I'm not convinced there can be an implementaiton that is shared by struct field access and variant. Variant has all of the quirks of needing stats to determine if the shredded field can be trusted, etc. But if there can be then I agree something like #26282 could be used to implement it with this PR as the API that backs it.
There was a problem hiding this comment.
I spent some time with #26282 to understand where they fit.
I like the split for get_field on a plain struct. The function says which struct paths it reads, the scan maps those paths to Parquet leaves, and nothing in Parquet needs to downcast GetFieldFunc.
Where I get stuck is Variant. Shredding only exists in each file's physical schema. At planning time variant_get sees an unshredded Variant, so the useful answer from required_fields only comes from the per-file call. That means ScalarUDFImpl answers a question about one file's storage layout, and if the schema adapter unshreds before execution, the function never runs on the layout it described. It feels like that knowledge belongs at the format/encoding layer rather than on the function.
So maybe the scope is:
NestedInputAccess(or something like it) for paths that exist at the logical level, like struct fields. A built-in resolver here would handle every function with the capability, soget_fieldloses its special case.- The resolver trait for layouts that only exist per file: shredded Variant, sidecar leaves, anything that needs bloom filters or per-page data.
That would also let #26282 drop the placeholder-column rewrite, since bind/StatsExpr gives it a place to plug in.
But at that point we are creating a trait that as far as I can tell only helps get_field i.e. a trait with a single user.
Does that match how you see it, or am I missing a case where the per-file required_fields is the better home for shredding?
| /// The built-in resolver for struct fields is always present. | ||
| /// | ||
| /// [`ParquetStatisticsResolver`]: crate::statistics_resolver::ParquetStatisticsResolver | ||
| pub fn with_statistics_resolver( |
There was a problem hiding this comment.
This only reaches scans where the caller builds the ParquetSource by hand. Is there a route for ListingTable or CREATE EXTERNAL TABLE, where the user registers a UDF but never sees the source?
There was a problem hiding this comment.
We can add that API later and wire it just like the other similar options.
| &self, | ||
| expr: &Arc<dyn PhysicalExpr>, | ||
| ) -> Option<Arc<dyn BoundExprStatistics>> { | ||
| if let Some(bound) = self.lock_bindings().get(expr) { |
There was a problem hiding this comment.
matches is called for every non-column node the rewrite visits, and bind starts with a HashMap lookup keyed by the expression, which hashes that node's whole subtree under the mutex. Once one key is bound the map is non-empty, so a long OR chain or a large dynamic filter hashes quadratically, per file, and again each time a dynamic filter updates. Could the resolvers get a cheap reject before the lookup?
There was a problem hiding this comment.
Agreed the quadratic behavior is not ideal. I will look into what we can do.
There was a problem hiding this comment.
Thanks for catching this. You were right: the per-file cache hashed the whole subtree at every node, so a deep predicate cost O(n²) or worse.
I changed the design in 65d4b9c so that the cache is gone. StatisticsExprMatcher::bind returns the resolver's binding, and the binding travels in the statistics key (StatsExpr). The statistics lookup reads the binding directly and does not look the expression up again. This removes the HashMap keyed by PhysicalExpr.
Timings for one file's predicate build, with a left-deep OR of s['a'] = i (release build):
| Terms | Before | After |
|---|---|---|
| 250 | 199 ms | 50 ms |
| 500 | 1.02 s | 95 ms |
| 1,000 | 7.26 s | 191 ms |
| 2,000 | 54.3 s | 382 ms |
The build time is now linear in the number of terms.
|
I am a little lost given the size of this PR and I didn't read the whole thing so I apologize if this is a silly question. If we had something like In my mind If that is insufficient (which may be the case for Variant as we need access to a few of the leaf field, I think) it seems like a more extendable way to support predicate pruning would be to add some method to PhysicalExpr trait to allow a expr to provide the min / maxes and remove all the hard coded use of |
d7ec2df to
a0b9e07
Compare
| /// A column of the file schema, by name. | ||
| Column(String), |
There was a problem hiding this comment.
Can't we always just address bloom filters by leaf index? Column is just the special case where the leaf = root.
| #[derive(Clone)] | ||
| pub struct StatsExpr { | ||
| expr: Arc<dyn PhysicalExpr>, | ||
| binding: Arc<dyn Any + Send + Sync>, |
There was a problem hiding this comment.
This type erasure is a bit ugly
| Some((BloomFilterKey::Column(name), leaf)) | ||
| }); | ||
| let exprs = predicate.literal_exprs().into_iter().filter_map(|expr| { | ||
| let leaf = struct_field_leaf(&expr)?.leaf; |
There was a problem hiding this comment.
This seems to be adding more special casing of struct field access
| column_sbbf: HashMap<String, ColumnBloomFilter>, | ||
| /// Bloom filters for expressions with their own statistics (such as | ||
| /// struct fields), by the leaf that the expression is bound to. | ||
| expr_sbbf: Vec<(usize, ColumnBloomFilter)>, |
There was a problem hiding this comment.
Feels like something went wrong if we need column_sbbf AND expr_sbbf.
| columns: Vec<(phys_expr::Column, StatisticsType, Field)>, | ||
| /// The expression of each entry in `columns`, at the same index, when | ||
| /// the statistics are for an expression with its own statistics (such | ||
| /// as `get_field(s, 'a')`) rather than for the column itself. The | ||
| /// column in `columns` is then the one column the expression reads. | ||
| stats_exprs: Vec<Option<StatsExpr>>, |
There was a problem hiding this comment.
Why do we need this split? Should RequiredColumns be refactored into something expression based? I.e. should this bemore like:
struct RequiredExprStatistics {
Vec<RequiredExprStatistic>,
}
struct RequiredExprStatistic {
exp: StatsExpr,
stats: StatisticsType,
field: Field,
}| // An expression with its own statistics is not the column itself, so | ||
| // callers that read per-column statistics (such as the page index) | ||
| // must not treat it as one. |
a0b9e07 to
1ea5fbf
Compare
49e049f to
78d4b90
Compare
## Which issue does this PR close? Part of apache#20871. It is split out of apache#27736. ## Rationale for this change `RequiredColumns::single_column()` has one user: Parquet page pruning. The check only makes sense for page pruning. The pages of each column have their own row boundaries, so page pruning can evaluate a predicate only on the pages of one column. Row group and file pruning have no such limit. The check is a few lines of code. So it belongs in the page filter, and `RequiredColumns` only needs to list what the predicate reads. apache#27736 lets a predicate read statistics of things that are not columns. There, "single column" on `RequiredColumns` has no meaning. That PR also replaces `columns()` with a typed accessor before the next release, so `columns()` does not become a long-term API. ## What changes are included in this PR? One call site in `page_filter.rs`: ```diff - let column = predicate.required_columns().single_column()?; + let column = single_column(predicate)?; ``` | Item | Where | Change | | --- | --- | --- | | `RequiredColumns::columns()` | `datafusion/pruning/src/pruning_predicate.rs` | New. Yields the column of each required statistic, in order. | | `RequiredColumns::single_column()` | `datafusion/pruning/src/pruning_predicate.rs` | Deprecated. Behavior is unchanged. | | `single_column(&PruningPredicate)` | `datafusion/datasource-parquet/src/page_filter.rs` | New private helper. Replaces the 4 call sites. | ## What is the testing strategy for this PR? - `required_columns_lists_each_statistic_column` asserts the exact column list of `a > 1 AND b < 2`. - `single_column_requires_one_column` asserts that a predicate on one column gives `Some(a)` and a predicate on two columns gives `None`. - The existing page pruning tests, `parquet_integration` and the Parquet sqllogictests pass unchanged. ## Are there any user-facing changes? `RequiredColumns::single_column()` is deprecated. `RequiredColumns::columns()` is new. Behavior does not change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
34aea50 to
9b4e704
Compare
## Which issue does this PR close? - Prepares for apache#27736. ## Rationale for this change Predicates on struct fields such as `s['a'] > 5` do not prune Parquet row groups or pages today. This PR records that behavior in tests. The follow-up PR apache#27736 adds the pruning and updates the expected output. Its diff then shows the effect of the change directly. ## What changes are included in this PR? This PR is tests only. It does not change any behavior. - `datafusion/sqllogictest/test_files/parquet_struct_field_pruning.slt` writes Parquet files with struct columns. It records the `EXPLAIN ANALYZE` row group and page pruning metrics for predicates on struct fields. ## What is the testing strategy for this PR? The PR consists of the new tests. They pass on `main` and record its current behavior. ## Are there any user-facing changes? No. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
## Which issue does this PR close? Part of apache#20871. It is split out of apache#27736. ## Rationale for this change `RequiredColumns::single_column()` has one user: Parquet page pruning. The check only makes sense for page pruning. The pages of each column have their own row boundaries, so page pruning can evaluate a predicate only on the pages of one column. Row group and file pruning have no such limit. The check is a few lines of code. So it belongs in the page filter, and `RequiredColumns` only needs to list what the predicate reads. apache#27736 lets a predicate read statistics of things that are not columns. There, "single column" on `RequiredColumns` has no meaning. That PR also replaces `columns()` with a typed accessor before the next release, so `columns()` does not become a long-term API. ## What changes are included in this PR? One call site in `page_filter.rs`: ```diff - let column = predicate.required_columns().single_column()?; + let column = single_column(predicate)?; ``` | Item | Where | Change | | --- | --- | --- | | `RequiredColumns::columns()` | `datafusion/pruning/src/pruning_predicate.rs` | New. Yields the column of each required statistic, in order. | | `RequiredColumns::single_column()` | `datafusion/pruning/src/pruning_predicate.rs` | Deprecated. Behavior is unchanged. | | `single_column(&PruningPredicate)` | `datafusion/datasource-parquet/src/page_filter.rs` | New private helper. Replaces the 4 call sites. | ## What is the testing strategy for this PR? - `required_columns_lists_each_statistic_column` asserts the exact column list of `a > 1 AND b < 2`. - `single_column_requires_one_column` asserts that a predicate on one column gives `Some(a)` and a predicate on two columns gives `None`. - The existing page pruning tests, `parquet_integration` and the Parquet sqllogictests pass unchanged. ## Are there any user-facing changes? `RequiredColumns::single_column()` is deprecated. `RequiredColumns::columns()` is new. Behavior does not change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
9b4e704 to
646bdfa
Compare
|
I will try and read this tomorrow |
## Which issue does this PR close? - Part of apache#20871. It is split out of apache#27736, which changes this code to read statistics of struct fields. This PR does not depend on that one and is useful without it. ## Rationale for this change `PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metrics` is one function of about 250 lines with 11 mutable locals. It mixes four things: ```text prune_plan_with_page_index_and_metrics about 250 lines guards (3 early returns) build inverse predicates only for LIMIT for each row group skip if fully matched for each predicate -> selection, matched pages apply selection to the access plan, count rows for each inverse predicate -> fully matched rows, only for LIMIT count pages write 4 metrics apply the LIMIT plan ``` The LIMIT path is the hardest part to follow, and it sits in the middle of ordinary pruning. The same four references to the file (`arrow_schema`, `parquet_schema`, `parquet_metadata`, `file_metrics`) go to every helper. ## What changes are included in this PR? `PagePruner` holds the file and the counts of one pass. Each step is one method: ```text prune_plan_with_page_index_and_metrics about 100 lines guards inverted_predicates() only for LIMIT for each row group skip if fully matched pruner.prune_row_group() pruner.apply_selection() pruner.fully_matched_selection() only for LIMIT pruner.counts.add_to(metrics) apply the LIMIT plan ``` | New item | Replaces | |---|---| | `PagePruner::prune_row_group` | The loop over the predicates, and the page counters | | `PagePruner::apply_selection` | The update of the access plan, and the row counters | | `PagePruner::fully_matched_selection` | The loop over the inverse predicates, with its `complete` flag | | `PagePruner::prune_pages_for_predicate` | The free function of the same name with six arguments | | `PagePruner::page_count` | `fully_matched_page_count`, and an inline copy of the same expression | | `PagePruner::has_complete_page_index` | The inline check and its debug message | | `PagePruningCounts` | Four `let mut total_*` and the four metric writes | | `PagePruningAccessPlanFilter::inverted_predicates` | The inline closure | No behavior changes. The points that could change it, and that I checked against the old code: - The order of the early returns. - When the row and page counts are updated. Page counts are still added once per row group that is not fully matched. - The number of predicate evaluations on the LIMIT path. The test `inverse_pruning_short_circuits` counts them. - A row group whose inverse predicates give an empty selection is still recorded as an empty selection, and not as "unknown". ## What is the testing strategy for this PR? No new tests: this is a refactor, and the existing tests cover the code. They pass without changes: - The unit tests of `datafusion-datasource-parquet` (318), including the page filter tests for LIMIT pruning. - The Parquet integration tests in `datafusion/core/tests/parquet` (265), which assert the page index metrics. - The Parquet and LIMIT pruning sqllogictests. I did not run benchmarks. The code runs the same steps in the same order, and it keeps the two page sets that the old code reuses across row groups. ## Are there any user-facing changes? No. Every new item is private. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
9385266 to
bb6a714
Compare
LiteralGuarantee::analyze finds guarantees for columns only. Pruning on the statistics of other expressions, such as a struct field, needs the same analysis for those expressions. Add ExprLiteralGuarantee<T>. Its analyze function takes a function that returns a target of type T for each expression that can have a guarantee, and each guarantee keeps its target. The caller decides once whether an expression is usable and what names its statistics. LiteralGuarantee::analyze is this analysis for columns. Its results do not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
bb6a714 to
b8122c6
Compare
|
run benchmark tpch clickbench_partitioned clickbench_pushdown |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing expr-stats-pruning (b8122c6) to 915c5b6 (merge-base) diff Run configurationrun benchmark clickbench_partitionedTrigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing expr-stats-pruning (b8122c6) to 915c5b6 (merge-base) diff Run configurationrun benchmark tpchTrigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing expr-stats-pruning (b8122c6) to 915c5b6 (merge-base) diff Run configurationrun benchmark clickbench_pushdownTrigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing expr-stats-pruning (b8122c6) to 915c5b6 (merge-base) diff Run configurationrun benchmark tpchTrigger commentCPU Details (lscpu)Details
Resource Usagetpch — base (merge-base)
tpch — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing expr-stats-pruning (b8122c6) to 915c5b6 (merge-base) diff Run configurationrun benchmark clickbench_partitionedTrigger commentCPU Details (lscpu)Details
Resource Usageclickbench_partitioned — base (merge-base)
clickbench_partitioned — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing expr-stats-pruning (b8122c6) to 915c5b6 (merge-base) diff Run configurationrun benchmark clickbench_pushdownTrigger commentCPU Details (lscpu)Details
Resource Usageclickbench_pushdown — base (merge-base)
clickbench_pushdown — branch
File an issue against this benchmark runner |
The rewrite of a pruning predicate identifies each statistic that it reads by a `phys_expr::Column`. So only a column can have statistics. Identify each statistic by two values: | Value | Type | Use | |----------|-------------------------|----------------------------------------| | `expr` | `Arc<dyn PhysicalExpr>` | The rewrite finds and replaces it | | `target` | `Column` | The statistics source reads by it | `PredicateBuildContext::resolve` returns the target of an expression. It accepts columns only, so the predicates do not change. The internal functions take the context in place of the schema, and `RequiredColumns` stores a `RequiredStatistic` struct in place of a tuple. This commit changes no public API. The next commit makes the target type a parameter. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A PruningPredicate can read the statistics of columns only, and it names them by column name. A statistics source that has statistics for other expressions, such as the leaf column of a struct field, cannot say so. Add StatisticsResolver. Its resolve method returns a target for each expression that has statistics, or None. The predicate stores the target and passes it back to the statistics source when it prunes, so the check "can the predicate use this expression" and the answer "which statistics does it read" are one call. | Item | Change | |-------------------------|---------------------------------------------| | PruningPredicate | Gets a target type parameter, default Column | | RequiredColumns | Same | | PruningPredicateBuilder | Gets with_resolver, default ColumnResolver | | PruningStatisticsSource | New trait: PruningStatistics for a target | Every PruningStatistics implements PruningStatisticsSource<Column>, so existing code compiles without changes. The predicates that the default resolver builds do not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Parquet statistics sources find the leaf column of a predicate column by name, each time the predicate reads a statistic. Row group statistics, bloom filters and the page index each do this in their own way. A name can only identify a top-level column. Resolve each expression of a pruning predicate to a ParquetStatisticsTarget (leaf index and Arrow field) when the predicate is built for a file. The three statistics sources read by target. | Build site | Resolver | |-----------------------------------------|---------------------------------| | Opener, push decoder, inverted predicate | ParquetStatisticsResolver | | Plan display, which has no file | ArrowStatisticsResolver | | Public methods that take a PruningPredicate | Build it again for the file | PagePruningAccessPlanFilter::new has no Parquet schema, so it must build its predicates again for each file. Deprecate it in favor of new_with_parquet_schema. The resolvers accept columns only, so pruning results do not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Parquet keeps min/max values, null counts, a page index and a bloom filter for the leaf column of every struct field. A filter such as `s['a'] > 15` uses none of them, because the scan resolves only columns to leaf columns. Resolve `get_field(s, 'a')`, and chains of it, to the leaf column of the field. This is the one place that inspects the function. Row group statistics, bloom filters, the page index, full match detection and dynamic filters then work for struct fields as they do for columns, with no other change. A path through a map or a list has no target, and neither has a field of a nested type. The slt diff shows the effect on each access path. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
b8122c6 to
6ed43c9
Compare
|
run benchmark clickbench_partitioned |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing expr-stats-pruning (6ed43c9) to 915c5b6 (merge-base) diff Run configurationrun benchmark clickbench_partitionedTrigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing expr-stats-pruning (6ed43c9) to 915c5b6 (merge-base) diff Run configurationrun benchmark clickbench_partitionedTrigger commentCPU Details (lscpu)Details
Resource Usageclickbench_partitioned — base (merge-base)
clickbench_partitioned — branch
File an issue against this benchmark runner |
Which issue does this PR close?
GetFieldFunc#21306.get_field, through aScalarUDFImplcapability.Rationale for this change
Parquet stores min/max values, null counts, a page index and a bloom filter for every struct field leaf. DataFusion ignores all of them for
s['a'], becausePruningPredicateonly knows top-level columns.Example
A file with 4 row groups of 3 rows each,
s: {a: int, b: int}:s['a']The same thing, for other access paths:
mains['a'] > 15(row groups)s['a'] >= 85(pages)s['a'] < 10over 2 filesORDER BY s['a'] DESC LIMIT 3(TopK dynamic filter)s['a'] = 50with bloom filterss['a']What changes are included in this PR?
Summary
s['a'] > 5prunes Parquet row groups, pages and bloom filters with the statistics of the leaf columns.a.datafusion/pruning) hold the design. Commit 4 applies it to Parquet. Commit 5 is the only one that changes query results.RequiredColumns::columns()becomestargets(). One deprecation,PagePruningAccessPlanFilter::new.A pruning predicate reads statistics by a typed target. A resolver gives each expression its target when the predicate is built. The predicate stores the target and hands it back to the statistics source when it prunes.
"Can the predicate use this expression" and "which statistics does it read" are one call. No code looks an expression up a second time when it prunes.
For one Parquet file:
sequenceDiagram participant O as Parquet opener participant R as ParquetStatisticsResolver participant P as PruningPredicate participant S as RowGroupPruningStatistics O->>R: new(file schemas) O->>P: build(predicate, resolver = R) P->>R: resolve(s['a']) R-->>P: target: leaf of s.a Note over P: s['a'] > 15 becomes s['a']_max > 15 O->>P: prune(S) P->>S: max_values(target) S-->>P: max of that leaf, one per row groupIn the Parquet crate, all of this is crate-private:
ParquetStatisticsTargetParquetStatisticsResolverget_fieldchain to a leaf of one file. The only code that inspectsGetFieldFuncArrowStatisticsResolverEXPLAINprintsPruningStatisticsSource<ParquetStatisticsTarget>A predicate with leaf targets belongs to one file. The public methods that take a plain
PruningPredicate(RowGroupAccessPlanFilter::prune_by_statisticsandprune_by_statistics_with_metadata) build it again for the file.PagePruningAccessPlanFilter::newhas no Parquet schema, so it is deprecated in favor ofnew_with_parquet_schema.Final state of the column and target APIs
This PR adds target forms next to several column forms. The plan is one form per concept. This PR deprecates only what it makes wrong. The other deprecations are follow-up work.
LiteralGuarantee,LiteralGuarantee::analyzeExprLiteralGuarantee. The doc comment states the planPruningPredicate::literal_guarantees()target_literal_guarantees(), built on first useExprLiteralGuarantee<T>,target_literal_guarantees()PruningStatisticsPruningStatisticsSource<Column>PruningStatisticsSource<T>ColumnResolver, theT = ColumndefaultsRequiredColumns::single_column()mainPagePruningAccessPlanFilter::newOpen questions:
ExprLiteralGuaranteeandtarget_literal_guaranteescarry prefixes that only make sense while the column forms exist. A rename after a release is a second break.RowGroupAccessPlanFilter::prune_by_statisticstakes a columnPruningPredicateand builds it again for the file. A constructor that takes the expression and both schemas can replace it, as forPagePruningAccessPlanFilter.How to review
Review commit by commit. Each commit builds and passes its tests.
feat:ExprLiteralGuarantee<T>physical-exprrefactor:the rewrite identifies each statistic by an expression and aColumntarget. No generics, no public API changepruningfeat:the target becomes a type parameter. AddsStatisticsResolverandPruningStatisticsSource<T>. ReplacesRequiredColumns::columns()withtargets()pruningrefactor:Parquet statistics sources read leaf targets. The resolvers accept columns onlydatasource-parquetmainpass unchangedfeat:resolveget_fieldto a leafdatasource-parquetpruning_predicate.rs, plus the new filestatistics_source.rs(505 lines, half of them tests).PagePrunersteps from #27975.What is the testing strategy for this PR?
parquet_struct_field_pruning.slt: every case in the table above, plus null structs, type drift and!=.mainholds the output without pruning (test: add struct field pruning tests #27876), and commit 5 shows the change.row_group_filter.rs, so the existing testrow_group_pruning_predicate_missing_null_countcovers both.statistics_expr.rs, for typed targets instatistics_source.rs, and for the public row group method with a struct field predicate.Benchmarks
Run on the benchmark runner against the merge base
915c5b608. The tree is the one of this head. No benchmark has a predicate on a struct field, so these runs measure the cost for existing queries.tpchclickbench_partitionedclickbench_pushdownThe three slower
clickbench_partitionedqueries are Q34, Q36 and Q39, at 1.06x to 1.07x.Not in this PR
variant_get, to resolve to a leaf. The resolver is one function in the Parquet crate today.Statistics/ColumnStatistics#20707).s['a'](Read only required Parquet leaf columns for UDFs on nested fields (e.g. shredded Variant access withvariant_get) #27588).Are there any user-facing changes?
PruningPredicate,RequiredColumnsandPruningPredicateBuilderget a type parameter with a defaultPruningStatisticsSourcetrait with the method names ofPruningStatisticsPagePruningAccessPlanFilter::newis deprecatedRequiredColumns::targets()replacescolumns(), which #27894 addedcolumns()EXPLAINshows apruning_predicateforget_fieldfilters, and scans prune on themStatisticsResolver,ColumnResolver,ExprLiteralGuaranteeThe upgrade guide has one entry, for the first two rows. The deprecation message names the replacement, so it has no entry.
🤖 Generated with Claude Code