arrow_arith::boolean

Function or_kleene

Source
pub fn or_kleene(
    left: &BooleanArray,
    right: &BooleanArray,
) -> Result<BooleanArray, ArrowError>
Expand description

Logical ‘or’ boolean values with Kleene logic

§Behavior

This function behaves as follows with nulls:

  • true or null = true
  • null or true = true
  • false or null = null
  • null or false = null
  • null or null = null

In other words, in this context a null value really means "unknown", and an unknown value ‘or’ true is always true. For a different null behavior, see function "or".

§Example

let a = BooleanArray::from(vec![Some(true), Some(false), None]);
let b = BooleanArray::from(vec![None, None, None]);
let or_ab = or_kleene(&a, &b).unwrap();
assert_eq!(or_ab, BooleanArray::from(vec![Some(true), None, None]));

§Fails

If the operands have different lengths