diff --git a/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/mod.rs b/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/mod.rs index eb4bd7a61cf2f..08bf787e01836 100644 --- a/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/mod.rs +++ b/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/mod.rs @@ -83,12 +83,12 @@ impl<'a> PredicatePushDown<'a> { let input = inputs[inputs.len() - 1]; let input_schema = lp_arena.get(input).schema(lp_arena); - let (pushdown_eligibility, alias_rename_map) = + let (eligibility, alias_rename_map) = pushdown_eligibility(input_schema.as_ref(), &exprs, &acc_predicates, expr_arena)?; - let local_predicates = match pushdown_eligibility { - PushdownEligibility::FullPushdown => vec![], - PushdownEligibility::PartialPushdown(allowed) => { + let local_predicates = match eligibility { + PushdownEligibility::Full => vec![], + PushdownEligibility::Partial(allowed) => { let mut out = Vec::::with_capacity(allowed.len()); for key in allowed { out.push(acc_predicates.remove(&key).unwrap()); @@ -255,8 +255,8 @@ impl<'a> PredicatePushDown<'a> { // contexts. Note boundary projections are handled elsewhere. let local_predicates = match pushdown_eligibility(lp.schema(lp_arena).as_ref(), &vec![], &acc_predicates, expr_arena)?.0 { - PushdownEligibility::FullPushdown => vec![], - PushdownEligibility::PartialPushdown(allowed) => { + PushdownEligibility::Full => vec![], + PushdownEligibility::Partial(allowed) => { let mut out = Vec::::with_capacity(allowed.len()); for key in allowed { out.push(acc_predicates.remove(&key).unwrap()); diff --git a/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/utils.rs b/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/utils.rs index 30a54f243bb48..90d6d41d8f9ab 100644 --- a/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/utils.rs +++ b/crates/polars-plan/src/logical_plan/optimizer/predicate_pushdown/utils.rs @@ -240,11 +240,12 @@ fn get_maybe_aliased_projection_to_input_name_map( } pub enum PushdownEligibility { - FullPushdown, - PartialPushdown(Vec>), + Full, + Partial(Vec>), NoPushdown, } +#[allow(clippy::type_complexity)] pub fn pushdown_eligibility( input_schema: &Schema, projection_nodes: &Vec, @@ -408,7 +409,7 @@ pub fn pushdown_eligibility( debug_assert!(!common_window_inputs.is_empty() || !has_window); if !has_window && projection_nodes.is_empty() { - return Ok((PushdownEligibility::FullPushdown, alias_to_col_map)); + return Ok((PushdownEligibility::Full, alias_to_col_map)); } // Note: has_window is constant. @@ -422,7 +423,7 @@ pub fn pushdown_eligibility( let allowed_predicates = acc_predicates .iter() - .filter_map(|(&ref key, &node)| { + .filter_map(|(key, &node)| { debug_assert!(ae_nodes_stack.is_empty()); ae_nodes_stack.push(node); @@ -456,11 +457,9 @@ pub fn pushdown_eligibility( match allowed_predicates.len() { 0 => Ok((PushdownEligibility::NoPushdown, alias_to_col_map)), - len if len == acc_predicates.len() => { - Ok((PushdownEligibility::FullPushdown, alias_to_col_map)) - }, + len if len == acc_predicates.len() => Ok((PushdownEligibility::Full, alias_to_col_map)), _ => Ok(( - PushdownEligibility::PartialPushdown(allowed_predicates), + PushdownEligibility::Partial(allowed_predicates), alias_to_col_map, )), }