Jefffrey commented on code in PR #11507:
URL: https://github.com/apache/arrow-rs/pull/11507#discussion_r4241069527


##########
arrow-cast/src/cast/dictionary.rs:
##########
@@ -190,7 +190,7 @@ fn dictionary_to_dictionary_cast<K: ArrowDictionaryKeyType>(
         UInt32 => Arc::new(DictionaryArray::<UInt32Type>::from(data)),
         UInt64 => Arc::new(DictionaryArray::<UInt64Type>::from(data)),
         _ => {
-            return Err(ArrowError::CastError(format!(
+            return Err(ArrowError::NotYetImplemented(format!(

Review Comment:
   thoughts on using `InvalidArgumentError` variant instead? i feel itll be a 
better fit, especially in this case as dictionaries with an unsupported key 
type are invalid
   
   and in general, we can say calling `cast` with types that cant cast to one 
another is an invalid call (and point users to using `can_cast_types` to 
checking if the cast they want is valid)



##########
arrow-cast/src/cast/dictionary.rs:
##########
@@ -593,9 +592,11 @@ where
     let string_view = array
         .as_any()
         .downcast_ref::<StringViewArray>()
-        .ok_or_else(|| {
-            ArrowError::ComputeError("Internal Error: Cannot cast to 
StringViewArray".to_string())
-        })?;
+        .unwrap_or_else(|| {

Review Comment:
   here we can use the `as_` functions, e.g.
   
   ```rust
   array.as_string_view()
   ```
   
   - https://docs.rs/arrow/latest/arrow/array/trait.AsArray.html
   
   same for the rest below



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