Jefffrey commented on code in PR #9019:
URL: https://github.com/apache/arrow-rs/pull/9019#discussion_r2637851578
##########
arrow-array/src/array/run_array.rs:
##########
@@ -161,22 +170,31 @@ impl<R: RunEndIndexType> RunArray<R> {
})
}
- /// Returns index to the physical array for the given index to the logical
array.
- /// This function adjusts the input logical index based on
`ArrayData::offset`
- /// Performs a binary search on the run_ends array for the input index.
+ /// Calls [`RunEndBuffer::get_physical_index`].
///
/// The result is arbitrary if `logical_index >= self.len()`
pub fn get_physical_index(&self, logical_index: usize) -> usize {
self.run_ends.get_physical_index(logical_index)
}
- /// Returns the physical indices of the input logical indices. Returns
error if any of the logical
- /// index cannot be converted to physical index. The logical indices are
sorted and iterated along
- /// with run_ends array to find matching physical index. The approach used
here was chosen over
- /// finding physical index for each logical index using binary search
using the function
- /// `get_physical_index`. Running benchmarks on both approaches showed
that the approach used here
+ /// Given the input `logical_indices`, return the corresponding physical
index
+ /// for each, according to the underlying [`RunEndBuffer`], taking into
account
+ /// any slicing that has occurred.
+ ///
+ /// Returns an error if any of the provided logical indices is out of
range.
+ ///
+ /// # Implementation
+ ///
+ /// The logical indices are sorted and iterated along with the `run_ends`
buffer
+ /// to find the matching physical index. The approach used here was chosen
over
+ /// finding the physical index for each logical index using binary search
via
+ /// the function [`RunEndBuffer::get_physical_index`].
+ ///
+ /// Running benchmarks on both approaches showed that the approach used
here
/// scaled well for larger inputs.
+ ///
/// See
<https://github.com/apache/arrow-rs/pull/3622#issuecomment-1407753727> for more
details.
+ // TODO: this technically should be a method on RunEndBuffer
Review Comment:
https://github.com/apache/arrow-rs/issues/9025
--
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]