-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor: support cast values to fixedsizelist #5340
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nits
arrow-cast/src/cast.rs
Outdated
@@ -141,6 +141,8 @@ pub fn can_cast_types(from_type: &DataType, to_type: &DataType) -> bool { | |||
} | |||
(_, List(list_to)) => can_cast_types(from_type, list_to.data_type()), | |||
(_, LargeList(list_to)) => can_cast_types(from_type, list_to.data_type()), | |||
(_, FixedSizeList(list_to,size)) if size.eq(&1_i32) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(_, FixedSizeList(list_to,size)) if size.eq(&1_i32) => { | |
(_, FixedSizeList(list_to,size)) if *size == 1 => { |
arrow-cast/src/cast.rs
Outdated
fn cast_values_to_fixed_size_list( | ||
array: &dyn Array, | ||
to: &FieldRef, | ||
size: &i32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size: &i32, | |
size: i32, |
arrow-cast/src/cast.rs
Outdated
@@ -802,6 +804,9 @@ pub fn cast_with_options( | |||
} | |||
(_, List(ref to)) => cast_values_to_list::<i32>(array, to, cast_options), | |||
(_, LargeList(ref to)) => cast_values_to_list::<i64>(array, to, cast_options), | |||
(_, FixedSizeList(ref to, size)) if size.eq(&1_i32) => { | |||
cast_values_to_fixed_size_list(array, to, size, cast_options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cast_values_to_fixed_size_list(array, to, size, cast_options) | |
cast_values_to_fixed_size_list(array, to, *size, cast_options) |
arrow-cast/src/cast.rs
Outdated
let list_array = cast(&array, &DataType::LargeList(field.clone())).unwrap(); | ||
let actual = list_array | ||
.as_any() | ||
.downcast_ref::<LargeListArray>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use AsArray please
Co-authored-by: Raphael Taylor-Davies <[email protected]>
Thanks again @Weijun-H |
Is there any particular reason we don't support the opposite -- i.e. "unwrap" a |
@sadboy it seems like a good idea to support the inverse (casting from FixedSizeList --> List/LargeList) i am not quite sure what you mean by |
Which issue does this PR close?
Closes #5339
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?