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


##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -464,6 +466,42 @@ impl FixedSizeBinaryArray {
     pub fn iter(&self) -> FixedSizeBinaryIter<'_> {
         FixedSizeBinaryIter::new(self)
     }
+
+    /// Applies a unary infallible function to a fixed-size binary array, 
producing a
+    /// new primitive array.
+    ///
+    /// This is the fastest way to perform an operation on a fixed-size binary 
array
+    /// when the benefits of a vectorized operation outweigh the cost of
+    /// branching nulls and non-nulls.
+    ///
+    /// # Null Handling
+    ///
+    /// Applies the function for all values, including those on null slots. 
This
+    /// will often allow the compiler to generate faster vectorized code, but
+    /// requires that the operation must be infallible (not error/panic) for 
any
+    /// value of the corresponding type or this function may panic.
+    pub fn unary<F, O>(&self, op: F) -> PrimitiveArray<O>

Review Comment:
   It is perhaps a little odd to have a member function unary on 
FixedSizeBinaryArray that returns a PrimitiveArray.
   
   I wonder if we could add a `PrimitiveArray::from_unary` instead, similar to 
what we have for BooleanArray - 
https://docs.rs/arrow-array/latest/arrow_array/array/struct.BooleanArray.html#method.from_unary



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to