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

Function iter_conjunction_owned

datafusion/expr/src/utils.rs:1068–1087  ·  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

1066///
1067/// See [`split_conjunction_owned`] for more details and an example.
1068pub fn iter_conjunction_owned(expr: Expr) -> impl Iterator<Item = Expr> {
1069 let mut stack = vec![expr];
1070 std::iter::from_fn(move || {
1071 while let Some(expr) = stack.pop() {
1072 match expr {
1073 Expr::BinaryExpr(BinaryExpr {
1074 right,
1075 op: Operator::And,
1076 left,
1077 }) => {
1078 stack.push(*right);
1079 stack.push(*left);
1080 }
1081 Expr::Alias(Alias { expr, .. }) => stack.push(*expr),
1082 other => return Some(other),
1083 }
1084 }
1085 None
1086 })
1087}
1088
1089/// Splits an owned conjunctive [`Expr`] such as `A AND B AND C` => `[A, B, C]`
1090///

Callers 1

f_upMethod · 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…