Skip to main content Skip to complementary content

ARRAY_SUM

This function calculates the sum of all non-null elements of the input.

If there are no non-null elements, the function returns 0. The behavior is similar to the SUM aggregate function but operates on an array.

Syntax

ARRAY_SUM(array)

Arguments

Name Type Description Default Value
array numeric A numeric array

Returns

The sum of all non-null elements of the input. If there are no non-null elements, the function returns 0. A primitive value input is considered to be an array with a single element.


Examples

array Output
array[1, 0.2, 30] 31.2

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!