Skip to content

Commit 38f727a

Browse files
committed
fix(stats): use in-place precision_add in add_for_sum
1 parent 6edcb6d commit 38f727a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

datafusion/common/src/stats.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ impl Precision<ScalarValue> {
265265
/// SUM-style addition with integer widening to match SQL `SUM` return
266266
/// types for smaller integral inputs.
267267
pub fn add_for_sum(&self, other: &Precision<ScalarValue>) -> Precision<ScalarValue> {
268-
precision_add(&self.cast_to_sum_type(), &other.cast_to_sum_type())
268+
let mut lhs = self.cast_to_sum_type();
269+
let rhs = other.cast_to_sum_type();
270+
precision_add(&mut lhs, &rhs);
271+
lhs
269272
}
270273

271274
/// Calculates the difference of two (possibly inexact) [`ScalarValue`] values,

0 commit comments

Comments
 (0)