Compute AVG of a numeric column (SUM / COUNT).
(batch: &RecordBatch, column_name: &str)
| 221 | |
| 222 | /// Compute AVG of a numeric column (SUM / COUNT). |
| 223 | pub 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 | /// |
nothing calls this directly
no test coverage detected