Skip to content

Commit

Permalink
feat: cast sum into f64 for avg
Browse files Browse the repository at this point in the history
  • Loading branch information
ChobobDev committed Nov 5, 2022
1 parent 2098414 commit 9e411bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/executor/aggregate/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl AggrValue {
match self {
Self::Count { count, .. } => Ok(Value::I64(count)),
Self::Sum(value) | Self::Min(value) | Self::Max(value) => Ok(value),
Self::Avg { sum, count } => sum.divide(&Value::F64(count as f64)),
Self::Avg { sum, count } => (sum.cast(&DataType::Float)?).divide(&Value::I64(count as i64)),
Self::Variance {
sum_square,
sum,
Expand Down

0 comments on commit 9e411bb

Please sign in to comment.