MCPcopy Create free account
hub / github.com/apache/datafusion / find_exprs_in_exprs

Function find_exprs_in_exprs

datafusion/expr/src/utils.rs:674–690  ·  view source on GitHub ↗

Search the provided `Expr`'s, and all of their nested `Expr`, for any that pass the provided test. The returned `Expr`'s are deduplicated and returned in order of appearance (depth first).

(
    exprs: impl IntoIterator<Item = &'a Expr>,
    test_fn: &F,
)

Source from the content-addressed store, hash-verified

672/// pass the provided test. The returned `Expr`'s are deduplicated and returned
673/// in order of appearance (depth first).
674fn find_exprs_in_exprs<'a, F>(
675 exprs: impl IntoIterator<Item = &'a Expr>,
676 test_fn: &F,
677) -> Vec<Expr>
678where
679 F: Fn(&Expr) -> bool,
680{
681 exprs
682 .into_iter()
683 .flat_map(|expr| find_exprs_in_expr(expr, test_fn))
684 .fold(vec![], |mut acc, expr| {
685 if !acc.contains(&expr) {
686 acc.push(expr)
687 }
688 acc
689 })
690}
691
692/// Search an `Expr`, and all of its nested `Expr`'s, for any that pass the
693/// provided test. The returned `Expr`'s are deduplicated and returned in order

Callers 2

find_aggregate_exprsFunction · 0.85
find_window_exprsFunction · 0.85

Calls 4

find_exprs_in_exprFunction · 0.85
into_iterMethod · 0.45
containsMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…