row_number

Description

Return the window index of the row within its groupby, when ordered by the orderby. Row indexes start at 1.

Return type

int64

Domain

This is a window function (calculates over a group of multiple input rows using windowing.)

Categories

Usage

row_number()

Examples

make_col index:window(row_number(), group_by(category_id), order_by(item_cost))

Assigns an index to items, when ordered by cost, grouped by category. The cheapest item in each category will be given the index 1.

Aliases

rownumber (deprecated)