prep_null_mask_filter

Function prep_null_mask_filter 

Source
pub fn prep_null_mask_filter(filter: &BooleanArray) -> BooleanArray
Expand description

Convert all null values in BooleanArray to false

This is useful for filter-like operations which select only true values, but not false or NULL values

Internally this is implemented as a bitwise AND operation with null bits and the boolean bits.

ยงExample

let filter = BooleanArray::from(vec![
  Some(true),
  Some(false),
  None
]);
// convert Boolean array to a filter mask
let null_mask = prep_null_mask_filter(&filter);
// there are no nulls in the output mask
assert!(null_mask.nulls().is_none());
assert_eq!(null_mask, BooleanArray::from(vec![
 true,
 false,
 false, // Null is converted to false
]));