alamb commented on code in PR #6592:
URL: https://github.com/apache/arrow-rs/pull/6592#discussion_r1809011612
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -1414,6 +1417,13 @@ pub fn cast_with_options(
cast_binary_to_fixed_size_binary::<i64>(array, *size,
cast_options)
}
BinaryView =>
Ok(Arc::new(BinaryViewArray::from(array.as_binary::<i64>()))),
+ Utf8View => {
+ let array = cast_binary_to_string::<i64>(array, cast_options)?;
+ Ok(Arc::new(StringViewArray::from(
+ cast_byte_container::<LargeUtf8Type,
Utf8Type>(array.as_ref())?
Review Comment:
I played around with this and found that `StringViewArray::from` works
directly from a `LargeStringArray` and pushed a commit I think helps.
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -5368,14 +5378,25 @@ mod tests {
{
let binary_array = GenericBinaryArray::<O>::from_iter(VIEW_TEST_DATA);
+ assert!(can_cast_types(
+ binary_array.data_type(),
+ &DataType::Utf8View
+ ));
+
assert!(can_cast_types(
binary_array.data_type(),
&DataType::BinaryView
));
+ let string_view_array = cast(&binary_array,
&DataType::Utf8View).unwrap();
Review Comment:
I double checked that this is invoked with both `BinaryArray` and
`LargeBinaryArray`
--
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]