tustvold commented on code in PR #7309:
URL: https://github.com/apache/arrow-rs/pull/7309#discussion_r2002141202


##########
arrow-array/src/builder/primitive_builder.rs:
##########
@@ -255,6 +255,41 @@ impl<T: ArrowPrimitiveType> PrimitiveBuilder<T> {
         self.values_builder.append_slice(values);
     }
 
+    /// Appends array values and null to this builder as is
+    /// (this means that underlying null values are copied as is).
+    ///
+    /// # Panics
+    ///
+    /// Panics if `array` and `self` data types are different
+    #[inline]
+    pub fn append_array(&mut self, array: &PrimitiveArray<T>) {
+        assert_eq!(
+            &self.data_type,
+            array.data_type(),
+            "array data type mismatch"
+        );
+
+        unsafe {
+            self.append_array_unchecked(array);
+        }
+    }
+
+    /// Appends array values and null to this builder as is
+    /// (this means that underlying null values are copied as is).
+    ///
+    /// # Safety
+    ///
+    /// `self` data type and `array` data type must be the same
+    #[inline]
+    pub unsafe fn append_array_unchecked(&mut self, array: &PrimitiveArray<T>) 
{

Review Comment:
   Right but unsafe is something one should use sparingly when the return 
justifies the risk, shaving off a couple of nanoseconds seems a pretty tough 
pill...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to