Window
| Function Name | Description |
|---|---|
| COUNT | Returns the total number of records for the specified expression. |
| COVAR_POP | Returns the population covariance for non-NULL pairs across all input values. |
| COVAR_SAMP | Returns the sample covariance for non-NULL pairs across all input values. |
| CUME_DIST | Returns the cumulative distribution of the current row with regard to other values within the same window partition. |
| DENSE_RANK | Returns the rank of the current row within its partition and ordering. Rows that are equal will have the same rank. |
| FIRST_VALUE | Returns the first value within an ordered group of a result set. |
| HLL | Uses HyperLogLog to return an approximation of the distinct cardinality of the input. |
| LAG | Returns the row before the current one in a partition based on the ORDER BY clause without the need for a self-join. If there are no rows, this function returns NULL. |
| LEAD | Returns the row after the current one in the same result set without the need for a self-join. If there are no rows, this function returns NULL. |
| MAX | Returns the maximum value among the non-NULL input expressions. |
| MIN | Returns the minimum value among the non-NULL input expressions. |
| NDV | Returns an approximate distinct value number, similar to COUNT(DISTINCT col). NDV can return results faster than using the combination of COUNT and DISTINCT while using a constant amount of memory, resulting in less memory usage for columns with high cardinality. |
| NTILE | Equally splits the rows in each partition into ranked parts specified by the integer value and starting from 1. This function requires the ORDER BY clause. |
| PERCENT_RANK | Returns the relative rank of the current row in the partition based on the ORDER BY clause. The displayed percentage ranges from 0.0 to 1.0. |
| RANK | Returns the rank of the current row within its partition and placement order. Rows that are equal have the same rank. However, the count of tied rows is added to the next rank, instead of being incremented by one. The rank value starts at 1 and increases sequentially. |
| ROW_NUMBER | Returns the row number for the current row based on the ORDER BY clause within each partition. Rows containing identical values receive different row numbers. |
| SUM | Returns the sum of non-NULL input expressions. |
| VAR_POP | Returns the population variance of non-NULL records. |
| VAR_SAMP | Returns the sample variance of non-NULL records. |
{{% snippet "window-function-overview-snippet.md" %}}