arrow_arith::aggregate

Function sum_checked

Source
pub fn sum_checked<T>(
    array: &PrimitiveArray<T>,
) -> Result<Option<T::Native>, ArrowError>
where T: ArrowNumericType, T::Native: ArrowNativeTypeOp,
Expand description

Returns the sum of values in the primitive array.

Returns Ok(None) if the array is empty or only contains null values.

This detects overflow and returns an Err for that. For an non-overflow-checking variant, use sum instead.