datafusion_expr::utils

Function conjunction

Source
pub fn conjunction(filters: impl IntoIterator<Item = Expr>) -> Option<Expr>
Expand description

Combines an array of filter expressions into a single filter expression consisting of the input filter expressions joined with logical AND.

Returns None if the filters array is empty.

ยงExample

// a=1 AND b=2
let expr = col("a").eq(lit(1)).and(col("b").eq(lit(2)));

// [a=1, b=2]
let split = vec![
  col("a").eq(lit(1)),
  col("b").eq(lit(2)),
];

// use conjunction to join them together with `AND`
assert_eq!(conjunction(split), Some(expr));