tustvold commented on code in PR #2579:
URL: https://github.com/apache/arrow-rs/pull/2579#discussion_r954130789
##########
arrow/src/array/iterator.rs:
##########
@@ -59,18 +60,16 @@ impl<T: ArrayAccessor> Iterator for ArrayIter<T> {
let old = self.current;
self.current += 1;
// Safety:
- // we just checked bounds in `self.current_end == self.current`
- // this is safe on the premise that this struct is initialized with
- // current = array.len()
- // and that current_end is ever only decremented
+ // This is safe as `current` cannot exceed the bounds of the array
+ // and we have verified that the value is not null
unsafe { Some(Some(self.array.value_unchecked(old))) }
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
(
- self.array.len() - self.current,
- Some(self.array.len() - self.current),
+ self.current_end - self.current,
Review Comment:
Drive by fix, the DoubleEndedIterator size hint previously would be incorrect
--
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]