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

ParameterTypeRequiredDescription
arrayARRAY<T>YesThe 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
Last update at: 2025/10/13 10:23:46