You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/17 08:20:59 UTC
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #2740: Add overflow-checking variants of arithmetic dyn kernels
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org