Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Huaxin Gao committed May 6, 2024
1 parent 66c8b8d commit ee05e3a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions core/src/execution/datafusion/expressions/stddev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl PartialEq<dyn Any> for Stddev {
self.name == x.name
&& self.expr.eq(&x.expr)
&& self.null_on_divide_by_zero == x.null_on_divide_by_zero
&& self.stats_type == x.stats_type
})
.unwrap_or(false)
}
Expand Down Expand Up @@ -168,13 +169,8 @@ impl Accumulator for StddevAccumulator {
fn evaluate(&mut self) -> Result<ScalarValue> {
let variance = self.variance.evaluate()?;
match variance {
ScalarValue::Float64(e) => {
if e.is_none() {
Ok(ScalarValue::Float64(None))
} else {
Ok(ScalarValue::Float64(e.map(|f| f.sqrt())))
}
}
ScalarValue::Float64(Some(e)) => Ok(ScalarValue::Float64(Some(e.sqrt()))),
ScalarValue::Float64(None) => Ok(ScalarValue::Float64(None)),
_ => internal_err!("Variance should be f64"),
}
}
Expand Down

0 comments on commit ee05e3a

Please sign in to comment.