MCPcopy Create free account
hub / github.com/apache/arrow-rs / is_not_null

Function is_not_null

arrow-arith/src/boolean.rs:347–353  ·  view source on GitHub ↗

Returns a non-null [BooleanArray] with whether each value of the array is not null. # Error This function never errors. # Example ```rust # use arrow_array::BooleanArray; # use arrow_arith::boolean::is_not_null; let a = BooleanArray::from(vec![Some(false), Some(true), None]); let a_is_not_null = is_not_null(&a).unwrap(); assert_eq!(a_is_not_null, BooleanArray::from(vec![true, true, false])); ```

(input: &dyn Array)

Source from the content-addressed store, hash-verified

345/// assert_eq!(a_is_not_null, BooleanArray::from(vec![true, true, false]));
346/// ```
347pub fn is_not_null(input: &dyn Array) -> Result<BooleanArray, ArrowError> {
348 let values = match input.logical_nulls() {
349 None => BooleanBuffer::new_set(input.len()),
350 Some(n) => n.inner().clone(),
351 };
352 Ok(BooleanArray::new(values, None))
353}
354
355#[cfg(test)]
356mod tests {

Calls 4

logical_nullsMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45
innerMethod · 0.45