You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/01/29 18:40:31 UTC

[arrow-rs] branch master updated: Reduce PrimitiveArray::try_unary codegen (#3619)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 266e2cf28 Reduce PrimitiveArray::try_unary codegen (#3619)
266e2cf28 is described below

commit 266e2cf28242c5cd814bf6c47be45485674043e1
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Sun Jan 29 18:40:26 2023 +0000

    Reduce PrimitiveArray::try_unary codegen (#3619)
---
 arrow-array/src/array/primitive_array.rs | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/arrow-array/src/array/primitive_array.rs b/arrow-array/src/array/primitive_array.rs
index a757eb7dd..dfe076306 100644
--- a/arrow-array/src/array/primitive_array.rs
+++ b/arrow-array/src/array/primitive_array.rs
@@ -494,17 +494,6 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
         let len = self.len();
         let null_count = self.null_count();
 
-        if null_count == 0 {
-            let values = self.values().iter().map(|v| op(*v));
-            // JUSTIFICATION
-            //  Benefit
-            //      ~60% speedup
-            //  Soundness
-            //      `values` is an iterator with a known size because arrays are sized.
-            let buffer = unsafe { Buffer::try_from_trusted_len_iter(values)? };
-            return Ok(unsafe { build_primitive_array(len, buffer, 0, None) });
-        }
-
         let null_buffer = data.null_buffer().map(|b| b.bit_slice(data.offset(), len));
         let mut buffer = BufferBuilder::<O::Native>::new(len);
         buffer.append_n_zeroed(len);