RANK

In a data query, you can use the RANK operator to associate rank levels to each element of the stream. It does not sort the stream of elements.

For example, if your stream contains: a, b, c, d, e, and your RANK operator has a sorter defined by descending order, you still have a, b, c, d, e but with ranks 5, 4, 3, 2, 1.

As for the SORT operator, you can specify multiple sorters to rank elements according to multiple attributes.

Note: The configuration parameters are the same as for the SORT operator.

This page discusses:

See Also
Expression Language
Defining Data Queries

Input

There is one input. There are no constraints on the element type or on the number of elements in the stream.

Output

There is one output. The output stream counts as many elements as the input stream counts, and the order (if any) is not affected.

The type of the elements is a tuple containing the rank (Integer) and the original element.

General Parameters

Parameter Description
Label

Specify the label to display below the operator type in the data query.

Description

Add a description to display as tooltip on hover over the operator icon.

Tip: It is useful to explain what the operator does, especially when you share the data query with other users.
Operator input variable Specify the name to give to the variable that contains the input data. The variable is then available when you define expressions.

Sorting Criteria Parameters

Parameter Description
Add sorter See daa-user-c-operator-sort.htm#daa-user-c-operator-sort__Sorters.
Stable result order Adds a stable sorting so that when the same elements come into the operator, they always come out in the same order.

Example

In this example, we associate a rank to every person regarding their age.

The result is a stream of tuples, each containing a person and a rank.