sunchao commented on code in PR #4707:
URL: https://github.com/apache/arrow-rs/pull/4707#discussion_r1322095995
##########
arrow-arith/src/arity.rs:
##########
@@ -105,10 +105,11 @@ where
let dict_values = array.values().as_any().downcast_ref().unwrap();
let values = try_unary::<T, F, T>(dict_values, op)?;
- Ok(Arc::new(array.with_values(&values)))
+ Ok(Arc::new(array.with_values(Arc::new(values))))
}
/// Applies an infallible unary function to an array with primitive values.
+#[deprecated(note = "Use arrow_array::AnyDictionaryArray")]
Review Comment:
> Additionally in this particular case it results in codegen for each type
of key type, and returns a PrimitiveArray when it could preserve the dictionary.
I can understand it has to do case analysis for different key types, but why
it would return a PrimitiveArray unnecessarily? it does call `unary_dict` which
preserves the dictionary right?
Yea, when seeing the deprecation message, I was expecting that a equivalent
function would be provided for users to migrate to, instead of having to find a
way to replicate the logic by themselves. I'm thinking we can come up with a
new implementation for `unary_dyn` without the key type enumeration problem?
--
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]