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

Function iter_conjunction

datafusion/expr/src/utils.rs:1044–1063  ·  view source on GitHub ↗

Iterate parts in a conjunctive [`Expr`] such as `A AND B AND C` => `[A, B, C]` See [`split_conjunction_owned`] for more details and an example.

(expr: &Expr)

Source from the content-addressed store, hash-verified

1042///
1043/// See [`split_conjunction_owned`] for more details and an example.
1044pub fn iter_conjunction(expr: &Expr) -> impl Iterator<Item = &Expr> {
1045 let mut stack = vec![expr];
1046 std::iter::from_fn(move || {
1047 while let Some(expr) = stack.pop() {
1048 match expr {
1049 Expr::BinaryExpr(BinaryExpr {
1050 right,
1051 op: Operator::And,
1052 left,
1053 }) => {
1054 stack.push(right);
1055 stack.push(left);
1056 }
1057 Expr::Alias(Alias { expr, .. }) => stack.push(expr),
1058 other => return Some(other),
1059 }
1060 }
1061 None
1062 })
1063}
1064
1065/// Iterate parts in a conjunctive [`Expr`] such as `A AND B AND C` => `[A, B, C]`
1066///

Callers 1

has_common_conjunctionFunction · 0.85

Calls 2

popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…