Jefffrey opened a new issue, #8841:
URL: https://github.com/apache/arrow-rs/issues/8841

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   When casting a dictionary with string value to binary view, run into an 
unexpected error.
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   This test should pass:
   
   ```rust
   // arrow-cast/src/cast/mod.rs
       #[test]
       fn test_string_dict_to_binary_view() {
           let values = StringArray::from_iter(VIEW_TEST_DATA);
           let keys = Int8Array::from_iter([Some(1), Some(0), None, Some(3), 
None, Some(1), Some(4)]);
           let string_dict_array =
               DictionaryArray::<Int8Type>::try_new(keys, 
Arc::new(values)).unwrap();
   
           let casted = cast(&string_dict_array, 
&DataType::BinaryView).unwrap();
           assert_eq!(casted.data_type(), &DataType::BinaryView);
       }
   ```
   
   Currently failing:
   
   ```sh
   thread 'cast::tests::test_string_dict_to_binary_view' (4994586) panicked at 
arrow-cast/src/cast/mod.rs:6651:70:
   called `Result::unwrap()` on an `Err` value: ComputeError("Internal Error: 
Cannot cast BinaryView to BinaryArray of expected type")
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   test cast::tests::test_string_dict_to_binary_view ... FAILED
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   Should successfully cast to a binary view.
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   
   Discovered in DataFusion: 
https://github.com/apache/datafusion/pull/18662#discussion_r2525927446
   
   Related code is here:
   
   
https://github.com/apache/arrow-rs/blob/2bc269c3eec23f6794fcd793b641ea4c08325d54/arrow-cast/src/cast/dictionary.rs#L107-L125
   
   - It's likely the same will happen for vice-versa situation, i.e. binary 
dictionary to string view (see above arm)
   
   Related PR: #5871


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

Reply via email to