Skip to main content Skip to complementary content

Array functions

Array functions process elements in a single collection or array value.

When to use array functions

Array functions operate on collection values (arrays), processing all elements in a single array field. Use array functions when you need to perform operations on values stored in an array or collection, rather than across multiple rows.

For example, to calculate the average of values stored in an array field:
WITH $ratings = ( FROM customer SELECT rating )
SELECT arrayAvg($ratings)

To distinguish array functions from aggregation functions: array functions operate on a single collection value, while aggregation functions process values in an iterative context across multiple rows. For iterative aggregation, see Aggregation functions.

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!