vegarsti commented on code in PR #8735:
URL: https://github.com/apache/arrow-rs/pull/8735#discussion_r2478049561
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -864,9 +877,41 @@ 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() {
+ // To transform inner type, can first cast to ListView
with new inner type.
Review Comment:
Totally right! Removed
--
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]