From 0b09513ecd89c10e348a1e84da34fef2e8dd5b75 Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Fri, 12 Nov 2021 04:52:53 +0000 Subject: [PATCH] Improved performance of is_no_null. --- src/compute/boolean.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compute/boolean.rs b/src/compute/boolean.rs index 2977ef03582..bd6b9be8e6d 100644 --- a/src/compute/boolean.rs +++ b/src/compute/boolean.rs @@ -124,7 +124,11 @@ pub fn is_null(input: &dyn Array) -> BooleanArray { /// ``` pub fn is_not_null(input: &dyn Array) -> BooleanArray { let values = match input.validity() { - None => Bitmap::from_trusted_len_iter(std::iter::repeat(true).take(input.len())), + None => { + let mut mutable = MutableBitmap::new(); + mutable.extend_constant(input.len(), true); + mutable.into() + } Some(buffer) => buffer.clone(), }; BooleanArray::from_data(DataType::Boolean, values, None)