pub fn nullif_scalar(lhs: &dyn Array, rhs: &dyn Scalar) -> Box<dyn Array>
Available on crate feature compute_nullif only.
Expand description

Returns an Array with the same type as lhs and whose validity is null iff either lhs == rhs or lhs is null.

Panics

iff

  • Scalar is null
  • lhs and rhs do not have the same type
  • The physical type is not supported for this operation (use can_nullif to check)

Example

let lhs = Int32Array::from(&[None, None, Some(1), Some(0), Some(1)]);
let rhs = PrimitiveScalar::<i32>::from(Some(0));
let result = nullif_scalar(&lhs, &rhs);

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

assert_eq!(expected, result.as_ref());