pub fn primitive_nullif<T>(lhs: &PrimitiveArray<T>, rhs: &PrimitiveArray<T>) -> PrimitiveArray<T>
where
    T: NativeType + Simd8,
    T::Simd: Simd8PartialEq,
{
    let equal = primitive_compare_values_op(lhs.values(), rhs.values(), |lhs, rhs| lhs.neq(rhs));
    let equal: Option<Bitmap> = equal.into();

    let validity = combine_validities(lhs.validity(), equal.as_ref());

    PrimitiveArray::<T>::from_data(lhs.data_type().clone(), lhs.values().clone(), validity)
}
/// Returns an array whose validity is null iff `lhs == rhs` or `lhs` is null.
/// This has the same semantics as postgres - the validity of the rhs is ignored.
/// # Panic
/// This function panics iff
/// * The arguments do not have the same logical type
/// * The arguments do not have the same length
/// # Example
/// ```rust
/// # use arrow2::array::Int32Array;
/// # use arrow2::datatypes::DataType;
/// # use arrow2::compute::nullif::primitive_nullif;
/// # fn main() {
/// let lhs = Int32Array::from(&[None, None, Some(1), Some(1), Some(1)]);
/// let rhs = Int32Array::from(&[None, Some(1), None, Some(1), Some(0)]);
/// let result = primitive_nullif(&lhs, &rhs);
///
/// let expected = Int32Array::from(&[None, None, Some(1), None, Some(1)]);
///
/// assert_eq!(expected, result);
/// # }
/// ```
Returns an array whose validity is null iff `lhs == rhs` or `lhs` is null.
This has the same semantics as postgres - the validity of the rhs is ignored.
Returns an array whose validity is null iff ` lhs == rhs ` or ` lhs ` is null . This has the same semantics as postgres - the validity of the rhs is ignored .
pub fn primitive_nullif<T>(lhs: &PrimitiveArray<T>, rhs: &PrimitiveArray<T>) -> PrimitiveArray<T>
where
    T: NativeType + Simd8,
    T::Simd: Simd8PartialEq,
{
    let equal = primitive_compare_values_op(lhs.values(), rhs.values(), |lhs, rhs| lhs.neq(rhs));
    let equal: Option<Bitmap> = equal.into();
    let validity = combine_validities(lhs.validity(), equal.as_ref());
    PrimitiveArray::<T>::from_data(lhs.data_type().clone(), lhs.values().clone(), validity)
}
pub fn primitive_nullif < T > ( lhs : & PrimitiveArray < T > , rhs : & PrimitiveArray < T > ) -> PrimitiveArray < T > where T : NativeType + Simd8 , T :: Simd : Simd8PartialEq , { let equal = primitive_compare_values_op ( lhs . values ( ) , rhs . values ( ) , | lhs , rhs | lhs . neq ( rhs ) ) ; let equal : Option < Bitmap > = equal . into ( ) ; let validity = combine_validities ( lhs . validity ( ) , equal . as_ref ( ) ) ; PrimitiveArray :: < T > :: from_data ( lhs . data_type ( ) . clone ( ) , lhs . values ( ) . clone ( ) , validity ) }
Returns an array whose validity is null iff `lhs == rhs` or `lhs` is null.
Returns an array whose validity is null iff ` lhs == rhs ` or ` lhs ` is null .
lhs
&PrimitiveArray<T>
rhs
&PrimitiveArray<T>
lhs
&PrimitiveArray<T>
rhs
&PrimitiveArray<T>
panic
This function panics iff
The arguments do not have the same logical type
The arguments do not have the same length
This function panics iff The arguments do not have the same logical type The arguments do not have the same length
example
None
use arrow2::array::int32array;
None
use arrow2::datatypes::datatype;
None
use arrow2::compute::nullif::primitive_nullif;
None
fn main() {
let lhs = Int32Array::from(&[None, None, Some(1), Some(1), Some(1)]);
let rhs = Int32Array::from(&[None, Some(1), None, Some(1), Some(0)]);
let result = primitive_nullif(&lhs, &rhs).

let expected = Int32Array::from(&[None, None, Some(1), None, Some(1)]).

assert_eq!(expected, result).
let lhs = Int32Array :: from ( & [ None None Some ( 1 ) Some ( 1 ) Some ( 1 ) ] ) ; let rhs = Int32Array :: from ( & [ None Some ( 1 ) None Some ( 1 ) Some ( 0 ) ] ) ; let result = primitive_nullif ( &lhs &rhs ) . let expected = Int32Array :: from ( & [ None None Some ( 1 ) None Some ( 1 ) ] ) . assert_eq! ( expected result ) .
}
None