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


##########
arrow/src/array/array.rs:
##########
@@ -356,6 +356,19 @@ pub trait ArrayAccessor: Array {
     /// # Safety
     /// Caller is responsible for ensuring that the index is within the bounds 
of the array
     unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
+
+    /// Returns a values accessor [`ArrayValuesAccessor`] for this 
[`ArrayAccessor`] if
+    /// it supports. Returns [`None`] if it doesn't support accessing values 
directly.
+    fn get_values_accessor(&self) -> Option<&dyn ArrayValuesAccessor<Item = 
Self::Item>> {

Review Comment:
   What is the point of the dyn indirection here?



##########
arrow/src/compute/kernels/arity.rs:
##########
@@ -297,8 +298,19 @@ where
     }
     let len = a.len();
 
-    if a.null_count() == 0 && b.null_count() == 0 {
-        let values = a.values().iter().zip(b.values()).map(|(l, r)| op(*l, 
*r));

Review Comment:
   I would rewrite this as external iteration, i.e. `for i in 0..array.len()` 
this is easier for the compiler, tends to optimise better and is simpler to 
understand. MutableBuffer::push_unchecked will behave equivalently
   
   The trusted len iterators are not necessary imo, and are probably best 
avoided in general.



-- 
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