vortex_array::compute

Trait OrFn

Source
pub trait OrFn {
    // Required methods
    fn or(&self, array: &ArrayData) -> VortexResult<ArrayData>;
    fn or_kleene(&self, array: &ArrayData) -> VortexResult<ArrayData>;
}

Required Methods§

Source

fn or(&self, array: &ArrayData) -> VortexResult<ArrayData>

Point-wise logical or between two Boolean arrays.

This method uses Arrow-style null propagation rather than the Kleene logic semantics.

§Examples
use vortex_array::ArrayData;
use vortex_array::compute::or;
use vortex_array::IntoCanonical;
use vortex_array::accessor::ArrayAccessor;
let a = ArrayData::from(vec![Some(true), Some(true), Some(true), None, None, None, Some(false), Some(false), Some(false)]);
let b = ArrayData::from(vec![Some(true), None, Some(false), Some(true), None, Some(false), Some(true), None, Some(false)]);
let result = or(a, b)?.into_canonical()?.into_bool()?;
let result_vec = result.with_iterator(|it| it.map(|x| x.cloned()).collect::<Vec<_>>())?;
assert_eq!(result_vec, vec![Some(true), None, Some(true), None, None, None, Some(true), None, Some(false)]);
Source

fn or_kleene(&self, array: &ArrayData) -> VortexResult<ArrayData>

Point-wise Kleene logical or between two Boolean arrays.

§Examples
use vortex_array::ArrayData;
use vortex_array::compute::or_kleene;
use vortex_array::IntoCanonical;
use vortex_array::accessor::ArrayAccessor;
let a = ArrayData::from(vec![Some(true), Some(true), Some(true), None, None, None, Some(false), Some(false), Some(false)]);
let b = ArrayData::from(vec![Some(true), None, Some(false), Some(true), None, Some(false), Some(true), None, Some(false)]);
let result = or_kleene(a, b)?.into_canonical()?.into_bool()?;
let result_vec = result.with_iterator(|it| it.map(|x| x.cloned()).collect::<Vec<_>>())?;
assert_eq!(result_vec, vec![Some(true), Some(true), Some(true), Some(true), None, None, Some(true), None, Some(false)]);

Implementors§