tustvold commented on code in PR #3681:
URL: https://github.com/apache/arrow-rs/pull/3681#discussion_r1104471075


##########
arrow-array/src/run_iterator.rs:
##########
@@ -57,14 +59,31 @@ where
 {
     /// create a new iterator
     pub fn new(array: TypedRunArray<'a, R, V>) -> Self {
-        let logical_len = array.len();
-        let physical_len: usize = array.values().len();
+        let current_front_physical: usize = if array.offset() > 0 {
+            array
+                .run_array()
+                .get_zero_offset_physical_index(array.offset())
+                .unwrap()
+        } else {
+            0
+        };
+        let sliced_end: usize = array.offset() + array.len();
+        let current_back_physical: usize =
+            if sliced_end == RunArray::<R>::logical_len(array.run_ends()) {
+                array.run_ends().len()
+            } else {
+                array
+                    .run_array()
+                    .get_zero_offset_physical_index(sliced_end - 1)
+                    .unwrap()
+                    + 1
+            };

Review Comment:
   ```suggestion
           let current_front_physical = 
array.run_array().get_physical_index(0).unwrap();
           let current_back_physical = 
array.run_array().get_physical_index(array.len()).unwrap();
   ```
   
   Perhaps?



-- 
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]

Reply via email to