alamb opened a new pull request #8340:
URL: https://github.com/apache/arrow/pull/8340


   NOTE: this builds on https://github.com/apache/arrow/pull/8333, so I am 
waiting on that to merge before turning this into a real PR)
   
   This PR removes the explicit plan-time cast support check from DataFusion 
and instead uses the runtime check of the [arrow compute cast 
kernel](https://github.com/apache/arrow/blob/master/rust/arrow/src/compute/kernels/cast.rs).
   
   The upside of this change is less code overall and increased casting support 
(DataFusion now supports all casting supported by Arrow rather than just the 
subset that was hard coded in `can_coerce_from`). 
   
   A potential downside is that an unsupported cast will produce an  error 
later in the process (after the plan has started running rather than during 
plan time).
   
   This PR is part of a set of changes to support `DictionaryArray`s in 
DataFusion. Once I add the appropriate support to the `cast` kernel, DataFusion 
will be able to cast `DictionaryArray` types correctly with no additional code.
   
   Prior to this change, the test in sql failed with this error message:
   
   ```
   ---- query_on_string_dictionary stdout ----
   thread 'query_on_string_dictionary' panicked at 'called `Result::unwrap()` 
on an `Err` value: General("\'Dictionary(Int32, Utf8) = Utf8\' can\'t be 
evaluated because there isn\'t a common type to coerce the types to")', 
datafusion/tests/sql.rs:925:16
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   ```
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to