Skip to content
Reference > Prepare Methods

unique(value)

Definition

Integer unique(Object value)

Description

each unique evaluation of value will return a unique integer, starting at 1. Repeat occurrences of expr will return the same integer value.

Parameter Definition

Name Type Description
value Object

Example

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