You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2025/11/14 06:27:30 UTC

[I] Cannot cast string dictionary to binary view [arrow-rs]

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Cannot cast string dictionary to binary view [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #8841:
URL: https://github.com/apache/arrow-rs/issues/8841#issuecomment-3716624133

   `label_issue.py` automatically added labels {'arrow'} from #8912


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Cannot cast string dictionary to binary view [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on issue #8841:
URL: https://github.com/apache/arrow-rs/issues/8841#issuecomment-3531097650

   If I comment out the `BinaryView` arm in the related code, the test passes successfully.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Cannot cast string dictionary to binary view [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #8841: Cannot cast string dictionary to binary view
URL: https://github.com/apache/arrow-rs/issues/8841


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org