MCPcopy Create free account
hub / github.com/apache/datafusion / array_min_max_helper

Function array_min_max_helper

datafusion/functions-nested/src/min_max.rs:202–219  ·  view source on GitHub ↗
(
    array: &GenericListArray<O>,
    is_min: bool,
)

Source from the content-addressed store, hash-verified

200}
201
202fn array_min_max_helper<O: OffsetSizeTrait>(
203 array: &GenericListArray<O>,
204 is_min: bool,
205) -> Result<ArrayRef> {
206 // Try the primitive fast path first
207 if let Some(result) = try_primitive_array_min_max(array, is_min) {
208 return result;
209 }
210
211 // Fallback: per-row ScalarValue path for non-primitive types
212 let agg_fn = if is_min { min_batch } else { max_batch };
213 let null_value = ScalarValue::try_from(array.value_type())?;
214 let result_vec: Vec<ScalarValue> = array
215 .iter()
216 .map(|arr| arr.as_ref().map_or_else(|| Ok(null_value.clone()), agg_fn))
217 .try_collect()?;
218 ScalarValue::iter_to_array(result_vec)
219}
220
221/// Dispatches to a typed primitive min/max implementation, or returns `None` if
222/// the element type is not a primitive.

Callers 2

array_max_innerFunction · 0.85
array_min_innerFunction · 0.85

Calls 6

value_typeMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…