MCPcopy Create free account
hub / github.com/apache/datafusion / evaluate

Method evaluate

datafusion/functions-aggregate/src/variance.rs:387–410  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

385 }
386
387 fn evaluate(&mut self) -> Result<ScalarValue> {
388 let count = match self.stats_type {
389 StatsType::Population => self.count,
390 StatsType::Sample => {
391 if self.count > 0 {
392 self.count - 1
393 } else {
394 self.count
395 }
396 }
397 };
398
399 Ok(ScalarValue::Float64(match self.count {
400 0 => None,
401 1 => {
402 if let StatsType::Population = self.stats_type {
403 Some(0.0)
404 } else {
405 None
406 }
407 }
408 _ => Some(self.m2 / count as f64),
409 }))
410 }
411
412 fn size(&self) -> usize {
413 size_of_val(self)

Calls 7

newFunction · 0.85
varianceMethod · 0.45
intoMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45