Rich-T-kid commented on code in PR #10807:
URL: https://github.com/apache/arrow-rs/pull/10807#discussion_r3895752169


##########
arrow-array/src/array/run_array.rs:
##########
@@ -116,30 +116,60 @@ impl<R: RunEndIndexType> RunArray<R> {
     /// - If `run_ends` has any null values
     /// - If `run_ends` doesn't consist of strictly increasing positive 
integers
     pub fn try_new(run_ends: &PrimitiveArray<R>, values: &dyn Array) -> 
Result<Self, ArrowError> {

Review Comment:
   looking at the spec again my comments dont seem to be accurate. an empty REE 
is considered valid as long as both the run ends & values are empty.
   
   this line made me think otherwise.
   > A run must have a length of at least 1. This means the values in the run 
ends array all are positive and in strictly ascending order. A run end cannot 
be null.
   
   ```
   #[test]
   fn try_new_accepts_empty_run_ends_and_values() {
       let run_ends = Int32Array::from(Vec::<i32>::new());
       let values = Int32Array::from(Vec::<i32>::new());
   
       let array = RunArray::<Int32Type>::try_new(&run_ends, &values).unwrap();
       assert_eq!(array.len(), 0);
   }
   ```
   
   with that in mind this PR does seem to catch all the edge cases when 
constructing an REE array.



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