RANK

This operator does not sort the stream of elements but associates rank levels to each element.

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.

Like in a 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 and Managing 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.

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.