Condividi tramite


Ranking Functions (U-SQL)

Summary

U-SQL provides some built-in SQL-based ranking functions that return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are nondeterministic.

In U-SQL, ranking functions can only be used in the following syntactic contexts:

  • As a window function in a windowing expression with the OVER clause where it will calculate the value for each window partition.

Ranking functions cannot be nested.

U-SQL provides the following built-in ranking functions (follow the links for more information):

Ranking Function Description
DENSE_RANK Returns the rank of rows within the partition of a window, without any gaps in the ranking.
NTILE Returns the number of the group to which the row belongs from among the groups that the windowing function has distributed the rows using an ordered partition.
RANK Returns the rank of each row within the window.
ROW_NUMBER Returns the sequential number of a row within a window.

See Also