manishkr commented on code in PR #9036:
URL: https://github.com/apache/arrow-rs/pull/9036#discussion_r2648943121


##########
arrow-select/src/concat.rs:
##########
@@ -377,20 +381,30 @@ where
         
PrimitiveArray::<R>::from_iter_values(run_arrays.iter().enumerate().flat_map(
             move |(i, run_array)| {
                 let adjustment = needed_run_end_adjustments[i];
+                let offset = 
R::Native::from_usize(run_array.offset()).unwrap();
+                let length = R::Native::from_usize(run_array.len()).unwrap();
+                let start = run_array.get_start_physical_index();
+                let len = run_array.get_end_physical_index() - start + 1;
+
                 run_array
                     .run_ends()
                     .values()
                     .iter()
-                    .map(move |run_end| *run_end + adjustment)
+                    .skip(start)
+                    .take(len)
+                    .map(move |run_end| {
+                        let value = *run_end - offset;
+                        value.min(length) + adjustment

Review Comment:
   This is essential for handling sliced RunArray, where the last physical run 
extends beyond the logical slice boundary. Added test case with analysis of 
this case. 
   



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