ethan-tyler commented on code in PR #9220:
URL: https://github.com/apache/arrow-rs/pull/9220#discussion_r2732591003
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -5718,6 +5718,418 @@ mod tests {
assert_eq!(dict_array.values().len(), 3);
}
+ #[test]
+ fn test_cast_string_array_to_dict_utf8_view() {
+ let array = StringArray::from(vec![Some("one"), None, Some("three"),
Some("one")]);
+
+ let cast_type =
+ DataType::Dictionary(Box::new(DataType::UInt16),
Box::new(DataType::Utf8View));
+ let cast_array = cast(&array, &cast_type).unwrap();
+ assert_eq!(cast_array.data_type(), &cast_type);
+
+ let dict_array = cast_array
+ .as_any()
+ .downcast_ref::<DictionaryArray<UInt16Type>>()
+ .unwrap();
Review Comment:
Agreed - Switched to `cast_array.as_dictionary::<UInt16Type>()` in the dict
view tests to remove the manual downcast boilerplate
--
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]