alamb commented on code in PR #7853:
URL: https://github.com/apache/arrow-datafusion/pull/7853#discussion_r1364563043
##########
datafusion/physical-expr/src/aggregate/average.rs:
##########
@@ -256,40 +292,55 @@ impl Accumulator for AvgAccumulator {
}
/// An accumulator to compute the average for decimals
-#[derive(Debug)]
-struct DecimalAvgAccumulator {
- sum: Option<i128>,
+struct DecimalAvgAccumulator<T: DecimalType + ArrowNumericType> {
+ sum: Option<T::Native>,
count: u64,
sum_scale: i8,
sum_precision: u8,
target_precision: u8,
target_scale: i8,
}
-impl Accumulator for DecimalAvgAccumulator {
+impl<T: DecimalType + ArrowNumericType> Debug for DecimalAvgAccumulator<T> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("DecimalAvgAccumulator")
+ .field("sum", &self.sum)
Review Comment:
is this needed because `#derive` doesn't know how to handle
`Option<T::Native>`?
--
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]