Skip to main content
Aggregate · Window
Rows with NULL key or SQL-NULL value are ignored. Duplicate keys raise an error. DISTINCT removes identical key/value tuples only.

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: VARIANT
  • NULL behavior: Rows with NULL key or SQL-NULL value are ignored. Duplicate keys raise an error. DISTINCT removes identical key/value tuples only.
  • Empty input: Returns an empty object on empty input.
  • Shape: VARIANT object containing retained keys and values.
  • Ordering: Object field order is unspecified.

Properties

Usage notes

  • With DISTINCT the same key plus different values still errors.
  • DISTINCT removes duplicates in grouped aggregation. Do not use it to remove duplicates in a window call.

Examples

Build a VARIANT object

  • The table displays the logical VARIANT object; object key order and client formatting can differ.

Build an object with numeric and boolean values

Object key order and client formatting can differ.

Limitations

  • Sliding windows that drop earlier rows are not supported. Start the frame at the first row in the group.
  • The value must already be VARIANT; other values need explicit conversion.
Last modified on October 15, 2026