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

Method merge_batch

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

Source from the content-addressed store, hash-verified

543 }
544
545 fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
546 // counts are summed
547 self.count += sum(states[0].as_primitive::<UInt64Type>()).unwrap_or_default();
548
549 // sums are summed
550 if let Some(x) = sum(states[1].as_primitive::<Float64Type>()) {
551 let v = self.sum.get_or_insert(0.);
552 *v += x;
553 }
554 Ok(())
555 }
556 fn retract_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
557 let values = values[0].as_primitive::<Float64Type>();
558 self.count -= (values.len() - values.null_count()) as u64;

Callers

nothing calls this directly

Calls 3

sumFunction · 0.85
accumulateMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected