ARRAY_AVG
All functions > ARRAY > ARRAY_AVG
Returns the arithmetic mean (average) of all numeric elements in an array.
Syntax
ARRAY_AVG(array: ARRAY<T>) → DOUBLE
sql
Type Parameters:
T
: Numeric type (BIGINT, DOUBLE, etc.)
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array | ARRAY<T> | Yes | The numeric array to calculate the average of |
Returns
The arithmetic mean as a DOUBLE value
Notes
- Calculates sum divided by count of non-NULL values
- Ignores NULL values in the calculation
- Always returns DOUBLE regardless of input type
- Returns NULL for empty arrays or arrays with only NULL values
- Uses floating-point arithmetic for precision