Jefffrey commented on code in PR #9274:
URL: https://github.com/apache/arrow-rs/pull/9274#discussion_r2749221079
##########
arrow-cast/src/cast/list.rs:
##########
@@ -212,6 +212,55 @@ where
Ok(Arc::new(array))
}
+pub(crate) fn cast_list_view_to_fixed_size_list<O: OffsetSizeTrait>(
+ array: &dyn Array,
+ field: &FieldRef,
+ size: i32,
+ cast_options: &CastOptions,
+) -> Result<ArrayRef, ArrowError> {
+ let array = array.as_list_view::<O>();
+
+ let nullable = cast_options.safe || array.null_count() != 0;
+ let mut nulls = nullable.then(|| {
Review Comment:
Another idea I have is to use the `take` kernel to construct the values
array instead of mutable data; I think this is more efficient based on some
previous PRs I've seen do the same, though I'm stuck on what elements we fill
in the null slots with, especially for weird cases such as when the values
array is empty 🤔
- I guess can handle those cases separately
- We can always fill it with the first element in the array for example,
though maybe that could be inefficient if its a nested 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]