(&mut self)
| 519 | } |
| 520 | |
| 521 | fn evaluate(&mut self) -> Result<ScalarValue> { |
| 522 | // In sliding-window mode `retract_batch` can bring `count` back to 0 |
| 523 | // while `sum` remains `Some(..)` (possibly zero or a floating-point |
| 524 | // residual). Guard against that so the frame with no non-NULL values |
| 525 | // yields NULL rather than NaN / ±Inf. |
| 526 | let avg = if self.count == 0 { |
| 527 | None |
| 528 | } else { |
| 529 | self.sum.map(|f| f / self.count as f64) |
| 530 | }; |
| 531 | Ok(ScalarValue::Float64(avg)) |
| 532 | } |
| 533 | |
| 534 | fn size(&self) -> usize { |
| 535 | size_of_val(self) |
nothing calls this directly
no test coverage detected