fn must_keep<P, O>(observer: &O, chunk: &P, filter_expr: &Expr) -> bool
where
    P: Prunable,
    O: PruningObserver<Observed = P>,
{
    trace!(?filter_expr, schema=?chunk.schema(), "creating pruning predicate");

    let pruning_predicate = match PruningPredicate::try_new(filter_expr, chunk.schema()) {
        Ok(p) => p,
        Err(e) => {
            observer.could_not_prune_chunk(chunk, "Can not create pruning predicate");
            trace!(%e, ?filter_expr, "Can not create pruning predicate");
            return true;
        }
    };

    let statistics = PrunableStats {
        summary: chunk.summary(),
    };

    match pruning_predicate.prune(&statistics) {
        Ok(results) => {
            // Boolean array for each row in stats, false if the
            // stats could not pass the predicate
            let must_keep = results[0]; // 0 as PrunableStats returns a single row
            if !must_keep {
                observer.was_pruned(chunk)
            }
            must_keep
        }
        Err(e) => {
            observer.could_not_prune_chunk(chunk, "Can not evaluate pruning predicate");
            trace!(%e, ?filter_expr, "Can not evauate pruning predicate");
            true
        }
    }
}
/// returns true if rows in chunk may pass the predicate
returns true if rows in chunk may pass the predicate
returns true if rows in chunk may pass the predicate
fn must_keep<P, O>(observer: &O, chunk: &P, filter_expr: &Expr) -> bool
where
    P: Prunable,
    O: PruningObserver<Observed = P>,
{
    trace!(?filter_expr, schema=?chunk.schema(), "creating pruning predicate");
    let pruning_predicate = match PruningPredicate::try_new(filter_expr, chunk.schema()) {
        Ok(p) => p,
        Err(e) => {
            observer.could_not_prune_chunk(chunk, "Can not create pruning predicate");
            trace!(%e, ?filter_expr, "Can not create pruning predicate");
            return true;
        }
    };
    let statistics = PrunableStats {
        summary: chunk.summary(),
    };
    match pruning_predicate.prune(&statistics) {
        Ok(results) => {
            // Boolean array for each row in stats, false if the
            // stats could not pass the predicate
            let must_keep = results[0]; // 0 as PrunableStats returns a single row
            if !must_keep {
                observer.was_pruned(chunk)
            }
            must_keep
        }
        Err(e) => {
            observer.could_not_prune_chunk(chunk, "Can not evaluate pruning predicate");
            trace!(%e, ?filter_expr, "Can not evauate pruning predicate");
            true
        }
    }
}
fn must_keep < P , O > ( observer : & O , chunk : & P , filter_expr : & Expr ) -> bool where P : Prunable , O : PruningObserver < Observed = P > , { trace ! ( filter_expr schema chunk schema ( ) " " ) ; let pruning_predicate = match PruningPredicate :: try_new ( filter_expr , chunk . schema ( ) ) { Ok ( p ) => p , Err ( e ) => { observer . could_not_prune_chunk ( chunk , " " ) ; trace ! ( e filter_expr " " ) ; return true ; } } ; let statistics = PrunableStats { summary : chunk . summary ( ) , } ; match pruning_predicate . prune ( & statistics ) { Ok ( results ) => { // Boolean array for each row in stats, false if the // stats could not pass the predicate let must_keep = results [ 0 ] ; // 0 as PrunableStats returns a single row if ! must_keep { observer . was_pruned ( chunk ) } must_keep } Err ( e ) => { observer . could_not_prune_chunk ( chunk , " " ) ; trace ! ( e filter_expr " " ) ; true } } }
returns true if rows in chunk may pass the predicate
returns true if rows in chunk may pass the predicate
observer
&O
chunk
&P
filter_expr
&Expr
observer
&O
chunk
&P
filter_expr
&Expr