Compute COUNT of non-null values in a column.
(batch: &RecordBatch, column_name: &str)
| 214 | |
| 215 | /// Compute COUNT of non-null values in a column. |
| 216 | pub fn arrow_count(batch: &RecordBatch, column_name: &str) -> Option<usize> { |
| 217 | let idx = batch.schema().index_of(column_name).ok()?; |
| 218 | let array = batch.column(idx); |
| 219 | Some(array.len() - array.null_count()) |
| 220 | } |
| 221 | |
| 222 | /// Compute AVG of a numeric column (SUM / COUNT). |
| 223 | pub fn arrow_avg(batch: &RecordBatch, column_name: &str) -> Option<f64> { |