datafusion_expr::utils

Function disjunction

Source
pub fn disjunction(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 OR.

Returns None if the filters array is empty.

ยงExample

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

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

// use disjuncton to join them together with `OR`
assert_eq!(disjunction(split), Some(expr));