Skip to main content
Window function
Returns a non-NULL fraction for every input row.

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.

Window

Arguments

Takes no arguments.

Returns

  • Type: DOUBLE
  • Possible values: Greater than 0 and at most 1 for groups containing at least one row.
  • NULL behavior: Returns a non-NULL fraction for every input row.
  • Empty input: An empty input produces no rows.

Properties

Usage notes

  • Peers with equal ORDER BY values share the cumulative fraction; the final peer group receives 1.
  • Explicit window-frame clauses are not supported for this function.

Examples

Peer groups

Restart the calculation in each group

Last modified on October 15, 2026