Jefffrey commented on code in PR #7065: URL: https://github.com/apache/arrow-rs/pull/7065#discussion_r1946592305
########## arrow-cast/src/cast/list.rs: ########## @@ -88,6 +88,25 @@ where let mut mutable = MutableArrayData::new(vec![&values], nullable, cap); // The end position in values of the last incorrectly-sized list slice let mut last_pos = 0; + + // Need to flag when previous vector(s) are empty/None to distinguish from 'All slices were correct length' cases. + let is_prev_empty = if array.offsets().len() < 2 { + false + } else { + let first_offset = array + .offsets() + .first() + .ok_or_else(|| ArrowError::ComputeError("Failed to get the first offset".into()))? + .as_usize(); + let second_offset = array + .offsets() + .get(1) + .ok_or_else(|| ArrowError::ComputeError("Failed to get the second offset".into()))? + .as_usize(); Review Comment: ```suggestion let first_offset = array.offsets()[0].as_usize(); let second_offset = array.offsets()[1].as_usize(); ``` nit: safe to use index as case where len < 2 is guarded above, so it can't panic -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org