ethan-tyler commented on code in PR #9220:
URL: https://github.com/apache/arrow-rs/pull/9220#discussion_r2709412567


##########
arrow-cast/src/cast/dictionary.rs:
##########
@@ -272,6 +272,19 @@ pub(crate) fn cast_to_dictionary<K: 
ArrowDictionaryKeyType>(
             }
             pack_byte_to_dictionary::<K, GenericStringType<i64>>(array, 
cast_options)
         }
+        Utf8View => {
+            let base_value_type = match array.data_type() {
+                DataType::LargeUtf8 | DataType::Utf8View => 
DataType::LargeUtf8,
+                _ => DataType::Utf8,
+            };
+
+            let dict_base = cast_to_dictionary::<K>(array, &base_value_type, 
cast_options)?;
+            cast_with_options(

Review Comment:
   Yes, effectively equivalent. `cast_with_options(dict, Dictionary(..))` hits 
the `(Dictionary(..), _)` arm, which calls `dictionary_cast::<K>`, then routes 
to `dictionary_to_dictionary_cast` since the target is also `Dictionary(..)`. 
Same code path as calling `dictionary_cast::<K>` directly.
   
   Only difference: `cast_with_options` short-circuits when `from == to` 
(`:769-772`), which a direct `dictionary_cast` call skips. Doesn't affect 
actual dict to dict conversions.
   
   Happy to switch to explicit `dictionary_cast::<K>(...)` if you prefer, makes 
the dict-to-dict intent clearer. Let me know.



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