MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / arrow_avg

Function arrow_avg

nodedb/src/control/arrow_convert.rs:223–231  ·  view source on GitHub ↗

Compute AVG of a numeric column (SUM / COUNT).

(batch: &RecordBatch, column_name: &str)

Source from the content-addressed store, hash-verified

221
222/// Compute AVG of a numeric column (SUM / COUNT).
223pub fn arrow_avg(batch: &RecordBatch, column_name: &str) -> Option<f64> {
224 let sum = arrow_sum(batch, column_name)?;
225 let count = arrow_count(batch, column_name)?;
226 if count == 0 {
227 None
228 } else {
229 Some(sum / count as f64)
230 }
231}
232
233/// Decode Arrow IPC stream bytes back into a RecordBatch.
234///

Callers

nothing calls this directly

Calls 2

arrow_sumFunction · 0.85
arrow_countFunction · 0.85

Tested by

no test coverage detected