alamb commented on code in PR #24309:
URL: https://github.com/apache/datafusion/pull/24309#discussion_r3770340622


##########
datafusion/functions-aggregate-common/src/aggregate/sum_distinct/numeric.rs:
##########
@@ -40,10 +40,10 @@ pub struct DistinctSumAccumulator<T: ArrowPrimitiveType> {
 }
 
 impl<T: ArrowPrimitiveType> DistinctSumAccumulator<T> {
-    pub fn new(data_type: &DataType) -> Self {
+    pub fn new(data_type: DataType) -> Self {
         Self {
             values: GenericDistinctBuffer::new(data_type.clone()),
-            data_type: data_type.clone(),
+            data_type,

Review Comment:
   this is one clone removed



##########
datafusion/functions-aggregate/src/sum.rs:
##########
@@ -264,14 +264,14 @@ impl AggregateUDFImpl for Sum {
         if args.is_distinct {
             macro_rules! helper {
                 ($t:ty, $dt:expr) => {
-                    Ok(Box::new(DistinctSumAccumulator::<$t>::new(&$dt)))
+                    Ok(Box::new(DistinctSumAccumulator::<$t>::new($dt)))
                 };
             }
             downcast_sum!(args, helper)
         } else {
             macro_rules! helper {
                 ($t:ty, $dt:expr) => {
-                    Ok(Box::new(SumAccumulator::<$t>::new($dt.clone())))

Review Comment:
   this is the second clone removed



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to