Skip to content

Commit cb686ce

Browse files
committed
Add ::new fn for PushdownChecker
1 parent 00c422c commit cb686ce

File tree

1 file changed

+12
-14
lines changed
  • datafusion/core/src/datasource/physical_plan/parquet

1 file changed

+12
-14
lines changed

datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ struct PushdownChecker<'schema> {
299299
}
300300

301301
impl<'schema> PushdownChecker<'schema> {
302+
fn new(file_schema: &'schema Schema, table_schema: &'schema Schema) -> Self {
303+
Self {
304+
non_primitive_columns: false,
305+
projected_columns: false,
306+
required_column_indices: BTreeSet::default(),
307+
file_schema,
308+
table_schema,
309+
}
310+
}
311+
302312
fn check_single_column(&mut self, column_name: &str) -> Option<TreeNodeRecursion> {
303313
if let Ok(idx) = self.file_schema.index_of(column_name) {
304314
self.required_column_indices.insert(idx);
@@ -369,13 +379,7 @@ pub fn non_pushdown_columns(
369379
file_schema: &Schema,
370380
table_schema: &Schema,
371381
) -> Result<Option<ProjectionAndExpr>> {
372-
let mut checker = PushdownChecker {
373-
non_primitive_columns: false,
374-
projected_columns: false,
375-
required_column_indices: BTreeSet::new(),
376-
file_schema,
377-
table_schema,
378-
};
382+
let mut checker = PushdownChecker::new(file_schema, table_schema);
379383

380384
let expr = expr.rewrite(&mut checker).data()?;
381385

@@ -394,13 +398,7 @@ fn would_column_prevent_pushdown(
394398
file_schema: &Schema,
395399
table_schema: &Schema,
396400
) -> bool {
397-
let mut checker = PushdownChecker {
398-
non_primitive_columns: false,
399-
projected_columns: false,
400-
required_column_indices: BTreeSet::new(),
401-
file_schema,
402-
table_schema,
403-
};
401+
let mut checker = PushdownChecker::new(file_schema, table_schema);
404402

405403
// the return of this is only used for [`PushdownChecker::f_down()`], so we can safely ignore
406404
// it here. I'm just verifying we know the return type of this so nobody accidentally changes

0 commit comments

Comments
 (0)