Skip to main content
Aggregates distinct values (including NULL) in an ARRAY column into an array (from multiple rows to one row). This function is supported from v3.2.

Syntax

Parameters

  • col: the column whose values you want to aggregate. Supported data type is ARRAY.

Return value

Returns a value of the ARRAY type.

Usage notes

  • The order of the elements in an array is random.
  • The data type of the elements in the returned array is the same as the data type of the elements in the input column.
  • Returns NULL if there is no matched value.

Examples

Take the following data table as an example:
Example 1: Group the values in column a and aggregate distinct values in column b into an array.
Example 2: Aggregate values in column b using the WHERE clause. If no data meets the filter condition, a NULL value is returned.

Keywords

ARRAY_UNIQUE_AGG, ARRAY