liamzwbao commented on code in PR #10377:
URL: https://github.com/apache/arrow-rs/pull/10377#discussion_r3997011581


##########
arrow-select/src/concat.rs:
##########
@@ -430,6 +430,16 @@ where
         return Ok(new_empty_array(arrays[0].data_type()));
     }
 
+    // Reject lengths that do not fit in `R` before any `R::Native` arithmetic 
can wrap.
+    let total_len: usize = run_arrays.iter().map(|r| r.len()).sum();
+    if R::Native::from_usize(total_len).is_none() {
+        return Err(ArrowError::ComputeError(format!(
+            "Concatenating RunArrays results in a logical length of 
{total_len}, \
+             which overflows the run-end type {}",
+            R::DATA_TYPE
+        )));
+    }

Review Comment:
   This is necessary to fix the failure reproduced in the UT 
`test_concat_run_array_length_overflows_run_end_type`



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