pub fn push_filters_through_map(
        &self,
        scalars: &Vec<MirScalarExpr>,
        predicates: &mut Vec<MirScalarExpr>,
        input_arity: usize,
        all_errors: bool,
    ) -> (Vec<MirScalarExpr>, Vec<MirScalarExpr>) {
        let mut pushdown = Vec::new();
        let mut retained = Vec::new();
        for mut predicate in predicates.drain(..) {
            // First, check if we can push this predicate down. We can do so if each
            // column it references is either from the input or is generated by an
            // expression that can be inlined.
            // We also will not push down literal errors, unless all predicates are.
            if (!predicate.is_literal_err() || all_errors)
                && predicate.support().iter().all(|c| {
                    *c < input_arity
                        || PredicatePushdown::can_inline(&scalars[*c - input_arity], input_arity)
                })
            {
                predicate.visit_mut_post(&mut |e| {
                    if let MirScalarExpr::Column(c) = e {
                        // NB: this inlining would be invalid if can_inline did not
                        // verify that scalars[*c - input_arity] referenced only
                        // expressions from the input and not any newly-constructed
                        // columns from the Map.
                        if *c >= input_arity {
                            *e = scalars[*c - input_arity].clone()
                        }
                    }
                });
                pushdown.push(predicate);
            } else {
                retained.push(predicate);
            }
        }
        (retained, pushdown)
    }
/// Computes "safe" predicates to push through a Map.
///
/// In the case of a Filter { Map {...} }, we can always push down the Filter
/// by inlining expressions from the Map. We don't want to do this in general,
/// however, since general inlining can result in exponential blowup in the size
/// of expressions, so we only do this in the case where we deem the referenced
/// expressions "safe." See the comment above can_inline for more details.
/// Note that this means we can always push down filters that only reference
/// input columns.
///
/// Returns the predicates that can be pushed down, followed by ones that cannot.
Computes "safe" predicates to push through a Map.
In the case of a Filter { Map {...} }, we can always push down the Filter
by inlining expressions from the Map. We don't want to do this in general,
however, since general inlining can result in exponential blowup in the size
of expressions, so we only do this in the case where we deem the referenced
expressions "safe." See the comment above can_inline for more details.
Note that this means we can always push down filters that only reference
input columns.

Returns the predicates that can be pushed down, followed by ones that cannot.
Computes " safe " predicates to push through a Map . In the case of a Filter { Map { ... } } we can always push down the Filter by inlining expressions from the Map . We don ' t want to do this in general however since general inlining can result in exponential blowup in the size of expressions so we only do this in the case where we deem the referenced expressions " safe . " See the comment above can_inline for more details . Note that this means we can always push down filters that only reference input columns . Returns the predicates that can be pushed down followed by ones that cannot .
pub fn push_filters_through_map(
        &self,
        scalars: &Vec<MirScalarExpr>,
        predicates: &mut Vec<MirScalarExpr>,
        input_arity: usize,
        all_errors: bool,
    ) -> (Vec<MirScalarExpr>, Vec<MirScalarExpr>) {
        let mut pushdown = Vec::new();
        let mut retained = Vec::new();
        for mut predicate in predicates.drain(..) {
            // First, check if we can push this predicate down. We can do so if each
            // column it references is either from the input or is generated by an
            // expression that can be inlined.
            // We also will not push down literal errors, unless all predicates are.
            if (!predicate.is_literal_err() || all_errors)
                && predicate.support().iter().all(|c| {
                    *c < input_arity
                        || PredicatePushdown::can_inline(&scalars[*c - input_arity], input_arity)
                })
            {
                predicate.visit_mut_post(&mut |e| {
                    if let MirScalarExpr::Column(c) = e {
                        // NB: this inlining would be invalid if can_inline did not
                        // verify that scalars[*c - input_arity] referenced only
                        // expressions from the input and not any newly-constructed
                        // columns from the Map.
                        if *c >= input_arity {
                            *e = scalars[*c - input_arity].clone()
                        }
                    }
                });
                pushdown.push(predicate);
            } else {
                retained.push(predicate);
            }
        }
        (retained, pushdown)
    }
pub fn push_filters_through_map ( & self , scalars : & Vec < MirScalarExpr > , predicates : & mut Vec < MirScalarExpr > , input_arity : usize , all_errors : bool , ) -> ( Vec < MirScalarExpr > , Vec < MirScalarExpr > ) { let mut pushdown = Vec :: new ( ) ; let mut retained = Vec :: new ( ) ; for mut predicate in predicates . drain ( .. ) { // First, check if we can push this predicate down. We can do so if each // column it references is either from the input or is generated by an // expression that can be inlined. // We also will not push down literal errors, unless all predicates are. if ( ! predicate . is_literal_err ( ) || all_errors ) && predicate . support ( ) . iter ( ) . all ( | c | { * c < input_arity || PredicatePushdown :: can_inline ( & scalars [ * c - input_arity ] , input_arity ) } ) { predicate . visit_mut_post ( & mut | e | { if let MirScalarExpr :: Column ( c ) = e { // NB: this inlining would be invalid if can_inline did not // verify that scalars[*c - input_arity] referenced only // expressions from the input and not any newly-constructed // columns from the Map. if * c >= input_arity { * e = scalars [ * c - input_arity ] . clone ( ) } } } ) ; pushdown . push ( predicate ) ; } else { retained . push ( predicate ) ; } } ( retained , pushdown ) }
Computes "safe" predicates to push through a Map.
Computes " safe " predicates to push through a Map .
&self
scalars
&Vec<MirScalarExpr>
predicates
&mut Vec<MirScalarExpr>
input_arity
usize
all_errors
bool
&self
scalars
&Vec<MirScalarExpr>
predicates
&mut Vec<MirScalarExpr>
input_arity
usize
all_errors
bool