Skip to main content
Aggregate · Window
NULL values are ignored. The array itself is non-NULL.

Syntax

A window function keeps each input row and adds a result for that row. PARTITION BY groups rows with matching values; without it, all input rows form one group.

Aggregate

Window

  • Use a frame that includes all rows in the group or starts at the first row (UNBOUNDED PRECEDING). Sliding frames that drop earlier rows are not supported. RANGE frames with a numeric or time offset are not supported.

Arguments

Aggregate and window

Returns

  • Type: ARRAY<same SQL type as value>
  • NULL behavior: NULL values are ignored. The array itself is non-NULL.
  • Empty input: Returns an empty array for an empty global aggregate or all-NULL frame.
  • Shape: A one-dimensional array containing each non-NULL input value once.
  • Ordering: Element order is unspecified; sort the output if ordered presentation is required.

Properties

Usage notes

  • Duplicate and NULL values are removed automatically. DISTINCT is not needed.
  • INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

Examples

Duplicate and NULL values

All NULL values

Limitations

  • Use a frame that includes all rows in the group or starts at the first row (UNBOUNDED PRECEDING). Sliding frames that drop earlier rows are not supported. RANGE frames with a numeric or time offset are not supported.
  • WITHIN GROUP does not guarantee ordered output for this function. Sort the returned array when you need a particular order.
Last modified on October 15, 2026