vegarsti commented on code in PR #8735:
URL: https://github.com/apache/arrow-rs/pull/8735#discussion_r2472739220


##########
arrow-cast/src/cast/mod.rs:
##########
@@ -864,9 +877,40 @@ pub fn cast_with_options(
             let array = array.as_list::<i64>();
             cast_list_to_fixed_size_list::<i64>(array, field, *size, 
cast_options)
         }
-        (List(_) | LargeList(_), _) => match to_type {
+        (ListView(_), List(_)) => match to_type {
+            List(list_to) => cast_list_view_values::<i32>(array, list_to, 
cast_options),
+            _ => Err(ArrowError::CastError(
+                "Cannot cast list view to non-list data types".to_string(),
+            )),
+        },
+        (LargeListView(_), LargeList(_)) => match to_type {
+            LargeList(list_to) => cast_list_view_values::<i64>(array, list_to, 
cast_options),
+            _ => Err(ArrowError::CastError(
+                "Cannot cast list view to non-list data types".to_string(),
+            )),
+        },
+        (List(list_from) | LargeList(list_from), _) => match to_type {
             Utf8 => value_to_string::<i32>(array, cast_options),
             LargeUtf8 => value_to_string::<i64>(array, cast_options),
+            ListView(list_to) => {
+                if list_to.data_type() != list_from.data_type() {
+                    Err(ArrowError::CastError(
+                        "Cannot cast list to list view with different inner 
type".to_string(),
+                    ))
+                } else {

Review Comment:
   I'm not sure that this is the behavior we want, would we also want to 
support casting when the type is not the same?



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