sunchao commented on code in PR #7494:
URL: https://github.com/apache/arrow-datafusion/pull/7494#discussion_r1319046183


##########
datafusion/physical-expr/src/aggregate/average.rs:
##########
@@ -488,12 +488,10 @@ where
                 .map(|(sum, count)| (self.avg_fn)(sum, count))
                 .collect::<Result<Vec<_>>>()?;
             PrimitiveArray::new(averages.into(), Some(nulls)) // no copy
+                .with_data_type(self.return_data_type.clone())
         };
 
-        // fix up decimal precision and scale for decimals
-        let array = adjust_output_array(&self.return_data_type, 
Arc::new(array))?;

Review Comment:
   Oh yea, just realized this was added recently.



##########
datafusion/physical-expr/src/aggregate/average.rs:
##########
@@ -488,12 +488,10 @@ where
                 .map(|(sum, count)| (self.avg_fn)(sum, count))
                 .collect::<Result<Vec<_>>>()?;
             PrimitiveArray::new(averages.into(), Some(nulls)) // no copy
+                .with_data_type(self.return_data_type.clone())
         };
 
-        // fix up decimal precision and scale for decimals
-        let array = adjust_output_array(&self.return_data_type, 
Arc::new(array))?;

Review Comment:
   Oh yea, just realized `with_data_type` was added recently.



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