pub fn nullif(lhs: &dyn Array, rhs: &dyn Array) -> 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.
This has the same semantics as postgres - the validity of the rhs is ignored.
§Panics
This function panics iff
- The arguments do not have the same logical type
- The arguments do not have the same length
- The physical type is not supported for this operation (use
can_nullifto check)
§Example
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 = nullif(&lhs, &rhs);
let expected = Int32Array::from(&[None, None, Some(1), None, Some(1)]);
assert_eq!(expected, result.as_ref());