arrow::compute::kernels::boolean

Function and_kleene

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

Logical ‘and’ boolean values with Kleene logic

§Behavior

This function behaves as follows with nulls:

  • true and null = null
  • null and true = null
  • false and null = false
  • null and false = false
  • null and null = null

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

§Example

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

§Fails

If the operands have different lengths