tustvold commented on code in PR #4707:
URL: https://github.com/apache/arrow-rs/pull/4707#discussion_r1322126246


##########
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:
   > For instance, one of our cases
   
   That is no different from
   
   ```
   pub fn my_function(array: ArrayRef) -> ArrayRef {
       match array.data_type() {
           DataType::Int64 => {
               array.as_primitive::<Int64Type>().unary(|v| 
v.div_floor(MICROS_PER_SECOND)).unwrap()
           },
           ...
       }
   }
   ```
   The caller would need to recurse into the dictionary in order to ascertain 
the value type, at which point how is unary_dyn helping?
   



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