jorgecarleitao commented on a change in pull request #9402:
URL: https://github.com/apache/arrow/pull/9402#discussion_r576411761



##########
File path: rust/arrow/src/compute/kernels/cast.rs
##########
@@ -266,6 +278,45 @@ pub fn cast(array: &ArrayRef, to_type: &DataType) -> 
Result<ArrayRef> {
             let list = ListArray::from(Arc::new(array_data));
             Ok(Arc::new(list) as ArrayRef)
         }
+        (LargeList(_), LargeList(ref to)) => {
+            let data = array.data_ref();
+            let underlying_array = make_array(data.child_data()[0].clone());
+            let cast_array = cast(&underlying_array, to.data_type())?;
+            let array_data = ArrayData::new(
+                to.data_type().clone(),
+                array.len(),
+                Some(cast_array.null_count()),
+                cast_array
+                    .data()
+                    .null_bitmap()
+                    .clone()
+                    .map(|bitmap| bitmap.bits),
+                array.offset(),
+                // reuse offset buffer
+                data.buffers().to_vec(),
+                vec![cast_array.data()],

Review comment:
       What do you think about making this a function/generic that is used by 
both List and ListArray? It feels copy-pasted from `List`




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to