File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
datasource/physical_plan/parquet Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,9 @@ impl PagePruningAccessPlanFilter {
144144 return None ;
145145 }
146146
147- if pp. required_columns ( ) . n_columns ( ) > 1 {
147+ if pp. required_columns ( ) . single_column ( ) . is_none ( ) {
148148 debug ! ( "Ignoring multi-column page pruning predicate: {predicate}" ) ;
149+ return None ;
149150 }
150151
151152 Some ( pp)
@@ -196,7 +197,6 @@ impl PagePruningAccessPlanFilter {
196197 // The selection for this particular row group
197198 let mut overall_selection = None ;
198199 for predicate in page_index_predicates {
199-
200200 // find column index in the parquet schema
201201 let col_idx = find_column_index ( predicate, arrow_schema, parquet_schema) ;
202202 let row_group_metadata = & groups[ r] ;
Original file line number Diff line number Diff line change @@ -738,16 +738,22 @@ impl RequiredColumns {
738738 Self :: default ( )
739739 }
740740
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.
742744 ///
743745 /// 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+ }
751757 }
752758
753759 /// Returns an iterator over items in columns (see doc on
You can’t perform that action at this time.
0 commit comments