pub trait AndFn {
// Required methods
fn and(&self, array: &Array) -> VortexResult<Array>;
fn and_kleene(&self, array: &Array) -> VortexResult<Array>;
}
Required Methods§
Sourcefn and(&self, array: &Array) -> VortexResult<Array>
fn and(&self, array: &Array) -> VortexResult<Array>
Point-wise logical and between two Boolean arrays.
This method uses Arrow-style null propagation rather than the Kleene logic semantics.
§Examples
use vortex_array::Array;
use vortex_array::compute::and;
use vortex_array::IntoCanonical;
use vortex_array::accessor::ArrayAccessor;
let a = Array::from(vec![Some(true), Some(true), Some(true), None, None, None, Some(false), Some(false), Some(false)]);
let b = Array::from(vec![Some(true), None, Some(false), Some(true), None, Some(false), Some(true), None, Some(false)]);
let result = and(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(false), None, None, None, Some(false), None, Some(false)]);
Sourcefn and_kleene(&self, array: &Array) -> VortexResult<Array>
fn and_kleene(&self, array: &Array) -> VortexResult<Array>
Point-wise Kleene logical and between two Boolean arrays.
§Examples
use vortex_array::Array;
use vortex_array::compute::and_kleene;
use vortex_array::IntoCanonical;
use vortex_array::accessor::ArrayAccessor;
let a = Array::from(vec![Some(true), Some(true), Some(true), None, None, None, Some(false), Some(false), Some(false)]);
let b = Array::from(vec![Some(true), None, Some(false), Some(true), None, Some(false), Some(true), None, Some(false)]);
let result = and_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), None, Some(false), None, None, Some(false), Some(false), Some(false), Some(false)]);