adriangb opened a new pull request, #27894:
URL: https://github.com/apache/datafusion/pull/27894

   ## Which issue does this PR close?
   
   Part of https://github.com/apache/datafusion/issues/20871. It is split out 
of https://github.com/apache/datafusion/pull/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.
   
   https://github.com/apache/datafusion/pull/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)
   


-- 
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]

Reply via email to