Navigation :
partition
partition, function
def process partition(max: number): number
Returns an integer from 1 to max in a repeating sequence. This helper is
useful to split a table into max partitions, typically when used with scan.
max: the number of partitions (must be at least 1).
Example
table T[t] = extend.range(6)
T.Part = partition(3) scan t
show table "Partitions" with
T.N
T.Part
This outputs the following table:
| N |
Part |
| 1 |
1 |
| 2 |
2 |
| 3 |
3 |
| 4 |
1 |
| 5 |
2 |
| 6 |
3 |
The sequence is deterministic and repeats every max items.