vegarsti commented on code in PR #8735:
URL: https://github.com/apache/arrow-rs/pull/8735#discussion_r2473264804
##########
arrow-array/src/array/list_view_array.rs:
##########
@@ -454,6 +457,35 @@ impl<OffsetSize: OffsetSizeTrait> std::fmt::Debug for
GenericListViewArray<Offse
}
}
+impl<OffsetSize: OffsetSizeTrait> From<GenericListArray<OffsetSize>>
+ for GenericListViewArray<OffsetSize>
+{
+ fn from(value: GenericListArray<OffsetSize>) -> Self {
+ let field = match value.data_type() {
+ DataType::List(f) | DataType::LargeList(f) => Some(f.clone()),
+ _ => None,
+ }
+ .expect("Expected infallible creation of GenericListViewArray from
GenericList failed");
Review Comment:
Good suggestion! Done!
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -11866,4 +11910,129 @@ mod tests {
// Verify the run-ends were cast correctly (run ends at 3, 6, 9)
assert_eq!(run_array.run_ends().values(), &[3i64, 6i64, 9i64]);
}
+
+ #[test]
+ fn test_cast_list_view_to_list() {
Review Comment:
Added these tests and they pass now.
--
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]