tustvold commented on code in PR #3662:
URL: https://github.com/apache/arrow-rs/pull/3662#discussion_r1101583537
##########
arrow-array/src/array/run_array.rs:
##########
@@ -233,6 +275,63 @@ impl<R: RunEndIndexType> RunArray<R> {
}
Ok(physical_indices)
}
+
+ /// Returns a `RunArray` with zero offset and length matching the last
value
+ /// in run_ends array.
+ pub fn into_non_sliced_array(self) -> Result<Self, ArrowError> {
+ if self.data.offset() == 0 && self.data.len() ==
Self::logical_len(&self.run_ends)
+ {
+ return Ok(self);
+ }
+ // The physical index of original run_ends array from which the
`ArrayData`is sliced.
+ let start_physical_index =
Self::get_physical_index_from_run_ends_array(
+ &self.run_ends,
+ self.data.offset(),
+ )
+ .ok_or_else(|| {
Review Comment:
They can do, but they're unsafe so that wouldn't be unsound. I think
`unwrap` is perfectly fine here
--
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]