Dandandan commented on code in PR #8953:
URL: https://github.com/apache/arrow-rs/pull/8953#discussion_r2612241902
##########
arrow-select/src/interleave.rs:
##########
@@ -319,6 +321,45 @@ fn interleave_struct(
Ok(Arc::new(struct_array))
}
+fn interleave_list<O: OffsetSizeTrait>(
+ values: &[&dyn Array],
+ indices: &[(usize, usize)],
+ field: &FieldRef,
+) -> Result<ArrayRef, ArrowError> {
+ let interleaved = Interleave::<'_, GenericListArray<O>>::new(values,
indices);
+
+ let mut child_indices = Vec::new();
+ let mut offsets = Vec::with_capacity(indices.len() + 1);
+ offsets.push(O::from_usize(0).unwrap());
+
+ for (array, row) in indices {
+ let list = interleaved.arrays[*array];
+ let start = list.value_offsets()[*row].as_usize();
+ let end = list.value_offsets()[*row + 1].as_usize();
+
+ child_indices.extend((start..end).map(|i| (*array, i)));
+ offsets.push(O::from_usize(child_indices.len()).expect("offset
overflow"));
Review Comment:
It could use extend for the offsets as well
--
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]