Function datafusion_expr::utils::split_binary_owned
source · pub fn split_binary_owned(expr: Expr, op: Operator) -> Vec<Expr>
Expand description
Splits an owned binary operator tree Expr
such as A <OP> B <OP> C
=> [A, B, C]
This is often used to “split” expressions such as col1 = 5 AND col2 = 10
into [col1 = 5
, col2 = 10
];
§Example
// a=1 + b=2
let expr = col("a").eq(lit(1)).add(col("b").eq(lit(2)));
// [a=1, b=2]
let split = vec![
col("a").eq(lit(1)),
col("b").eq(lit(2)),
];
// use split_binary_owned to split them
assert_eq!(split_binary_owned(expr, Operator::Plus), split);