wiedld commented on code in PR #12199:
URL: https://github.com/apache/datafusion/pull/12199#discussion_r1733357307
##########
datafusion/substrait/tests/cases/roundtrip_logical_plan.rs:
##########
@@ -716,12 +716,29 @@ async fn all_type_literal() -> Result<()> {
date32_col = arrow_cast('2020-01-01', 'Date32') AND
binary_col = arrow_cast('binary', 'Binary') AND
large_binary_col = arrow_cast('large_binary', 'LargeBinary') AND
+ view_binary_col = arrow_cast(arrow_cast('binary_view', 'Binary'),
'BinaryView') AND
utf8_col = arrow_cast('utf8', 'Utf8') AND
- large_utf8_col = arrow_cast('large_utf8', 'LargeUtf8');",
+ large_utf8_col = arrow_cast('large_utf8', 'LargeUtf8') AND
+ view_utf8_col = arrow_cast('utf8_view', 'Utf8View');",
)
.await
}
+/// Arrow-cast does not currently handle direct casting from utf8 to
binaryView.
+#[tokio::test]
+async fn binaryview_type_literal_needs_casting_fix() -> Result<()> {
+ let err = roundtrip_all_types(
+ "select * from data where
+ view_binary_col = arrow_cast('binary_view', 'BinaryView');",
+ )
+ .await;
+
+ assert!(
+ matches!(err, Err(e) if e.to_string().contains("Unsupported CAST from
Utf8 to BinaryView"))
+ );
+ Ok(())
Review Comment:
Looks like we have a few missing `arrow_cast` implementations for BinaryView
(explicit casting). Going to file a ticket in arrow and put up a PR; I'll be
assessing possible changes in
[cast_with_options](https://github.com/apache/arrow-rs/blob/8a66174d2b87d71d0ecc71b04b2ffcecfd9c1cbf/arrow-cast/src/cast/mod.rs#L678)
and
[can_cast_types](https://github.com/apache/arrow-rs/blob/8a66174d2b87d71d0ecc71b04b2ffcecfd9c1cbf/arrow-cast/src/cast/mod.rs#L92).
Note that this is different than datafusion's type coercion, which was
[previously
updated](https://github.com/apache/datafusion/commit/ccb4baf0fc6b4dee983bb29f2282b9c19510a481)
to prefer coercion to the view types.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]