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

Function arrow_max

nodedb/src/control/arrow_convert.rs:202–213  ·  view source on GitHub ↗

Compute MAX of a numeric column using Arrow SIMD kernels.

(batch: &RecordBatch, column_name: &str)

Source from the content-addressed store, hash-verified

200
201/// Compute MAX of a numeric column using Arrow SIMD kernels.
202pub fn arrow_max(batch: &RecordBatch, column_name: &str) -> Option<f64> {
203 let idx = batch.schema().index_of(column_name).ok()?;
204 let array = batch.column(idx);
205
206 if let Some(f64_arr) = array.as_any().downcast_ref::<Float64Array>() {
207 arrow::compute::kernels::aggregate::max(f64_arr)
208 } else if let Some(i64_arr) = array.as_any().downcast_ref::<Int64Array>() {
209 arrow::compute::kernels::aggregate::max(i64_arr).map(|v| v as f64)
210 } else {
211 None
212 }
213}
214
215/// Compute COUNT of non-null values in a column.
216pub fn arrow_count(batch: &RecordBatch, column_name: &str) -> Option<usize> {

Callers

nothing calls this directly

Calls 3

okMethod · 0.45
schemaMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected