Skip to content
Reference > Prepare Methods

rank(value)

Definition

Integer rank(Comparable value)

Description

will evaluate value for all rows and the lowest value will get 1, 2nd will get 2, etc. If multiple rows value evaluate to the same value, they will get the same ranking.

Parameter Definition

Name Type Description
value Comparable

Example

Prepare *,rank(Price) as Sample from SampleData Partition by Symbol
+------+--------+-----+------+
|Symbol|Sequence|Price|Sample|
+------+--------+-----+------+
|CAT   |1       |50.0 |1     |
|CAT   |2       |54.0 |3     |
|CAT   |3       |52.0 |2     |
|CAT   |4       |52.0 |2     |
|CAT   |5       !null !null  |
|CAT   |6       |57.0 |4     |
|IBM   |1       |20.0 |1     |
|IBM   |2       |24.0 |3     |
|IBM   |3       |22.0 |2     |
|IBM   |4       |27.0 |4     |
|IBM   |5       !null !null  |
+------+--------+-----+------+