File tree 2 files changed +16
-10
lines changed
datasource/physical_plan/parquet
2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,9 @@ impl PagePruningAccessPlanFilter {
144
144
return None ;
145
145
}
146
146
147
- if pp. required_columns ( ) . n_columns ( ) > 1 {
147
+ if pp. required_columns ( ) . single_column ( ) . is_none ( ) {
148
148
debug ! ( "Ignoring multi-column page pruning predicate: {predicate}" ) ;
149
+ return None ;
149
150
}
150
151
151
152
Some ( pp)
@@ -196,7 +197,6 @@ impl PagePruningAccessPlanFilter {
196
197
// The selection for this particular row group
197
198
let mut overall_selection = None ;
198
199
for predicate in page_index_predicates {
199
-
200
200
// find column index in the parquet schema
201
201
let col_idx = find_column_index ( predicate, arrow_schema, parquet_schema) ;
202
202
let row_group_metadata = & groups[ r] ;
Original file line number Diff line number Diff line change @@ -738,16 +738,22 @@ impl RequiredColumns {
738
738
Self :: default ( )
739
739
}
740
740
741
- /// Returns number of unique columns
741
+ /// Returns Some(column) if this is a single column predicate.
742
+ ///
743
+ /// Returns None if this is a multi-column predicate.
742
744
///
743
745
/// Examples:
744
- /// * `a > 5 OR a < 10` returns `1`
745
- /// * `a > 5 OR b < 10` returns `2`
746
- pub ( crate ) fn n_columns ( & self ) -> usize {
747
- self . iter ( )
748
- . map ( |( c, _s, _f) | c)
749
- . collect :: < HashSet < _ > > ( )
750
- . len ( )
746
+ /// * `a > 5 OR a < 10` returns `Some(a)`
747
+ /// * `a > 5 OR b < 10` returns `None`
748
+ /// * `true` returns None
749
+ pub ( crate ) fn single_column ( & self ) -> Option < & phys_expr:: Column > {
750
+ let cols = self . iter ( ) . map ( |( c, _s, _f) | c) . collect :: < HashSet < _ > > ( ) ;
751
+
752
+ if cols. len ( ) == 1 {
753
+ cols. iter ( ) . next ( ) . copied ( )
754
+ } else {
755
+ None
756
+ }
751
757
}
752
758
753
759
/// Returns an iterator over items in columns (see doc on
You can’t perform that action at this time.
0 commit comments