commit | a55bed4360f21f0748faf4a0a103d00b161ff110 | [log] [tgz] |
---|---|---|
author | Ritchie Vink <ritchie46@gmail.com> | Thu Apr 15 06:39:55 2021 -0400 |
committer | Andrew Lamb <andrew@nerdnetworks.org> | Thu Apr 15 06:39:55 2021 -0400 |
tree | 4794e4b0793584a2484342df4e3a189bada2deaf | |
parent | c4a98c9ef322b47ee744e7464f6d9dd42310b6bf [diff] |
ARROW-12337: [Rust] add DoubleEndedIterator and ExactSizeIterator traits This PR implements the traits `DoubleEndedIterator` and `ExactSizeIterator` for the arrow array iterators. For the trait `ExactSizeIterator` this is an indication of the types system that their size is known, and `DoubleEndedIterator` make them iterable in reverse order. Both include the improve of the iterators. Regarding this, I notice that the iterators check bounds twice. ```rust fn next(&mut self) -> Option<Self::Item> { let i = self.current; if i >= self.current_end { // first bounds check None } else if self.array.is_null(i) { self.current += 1; Some(None) } else { self.current += 1; Some(Some(self.array.value(i))) // second bounds check in `array.value` } } ``` In some implementations `self.array.value` includes a second bounds check. Shall I propose a PR that uses `self.array.value_unchecked`? This is safe as the bounds are already checked. Closes #9994 from ritchie46/more_iterator_traits Authored-by: Ritchie Vink <ritchie46@gmail.com> Signed-off-by: Andrew Lamb <andrew@nerdnetworks.org>
Apache Arrow is a development platform for in-memory analytics. It contains a set of technologies that enable big data systems to process and move data fast.
Major components of the project include:
Arrow is an Apache Software Foundation project. Learn more at arrow.apache.org.
The reference Arrow libraries contain many distinct software components:
The official Arrow libraries in this repository are in different stages of implementing the Arrow format and related features. See our current feature matrix on git master.
Please read our latest project contribution guide.
Even if you do not plan to contribute to Apache Arrow itself or Arrow integrations in other projects, we'd be happy to have you involved: