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

Method update_batch

datafusion/functions-aggregate/src/average.rs:511–519  ·  view source on GitHub ↗
(&mut self, values: &[ArrayRef])

Source from the content-addressed store, hash-verified

509
510impl Accumulator for AvgAccumulator {
511 fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
512 let values = values[0].as_primitive::<Float64Type>();
513 self.count += (values.len() - values.null_count()) as u64;
514 if let Some(x) = sum(values) {
515 let v = self.sum.get_or_insert(0.);
516 *v += x;
517 }
518 Ok(())
519 }
520
521 fn evaluate(&mut self) -> Result<ScalarValue> {
522 // In sliding-window mode `retract_batch` can bring `count` back to 0

Callers

nothing calls this directly

Calls 5

sumFunction · 0.85
null_countMethod · 0.80
accumulateMethod · 0.80
lenMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected