range()
Creates a list of values between start and stop - the stop parameter is exclusive.
Reference: Haybarn WASM 2.0.0-rc12
Arguments & returns
10 overloadsrange(stop)
Scalar
| Overload link | stop |
Returns |
|---|---|---|
| #01 | BIGINT |
BIGINT[] |
range(start, stop)
Scalar
| Overload link | start | stop |
Returns |
|---|---|---|---|
| #02 | BIGINT | BIGINT |
BIGINT[] |
range(start, stop, step)
Scalar
range(stop)
Table
| Overload link | stop |
Returns |
|---|---|---|
| #06 | BIGINT |
TABLE |
range(start, stop)
Table
| Overload link | start | stop |
Returns |
|---|---|---|---|
| #07 | BIGINT | BIGINT |
TABLE |
range(start, stop, step)
Table
Generate a sequence with an exclusive stop
Generate numeric sequences as a list or as rows. The stop value is excluded, which makes range useful for bounded iteration.
With a positive step, a start equal to the stop produces no values.
Haybarn WASM 2.0.0-rc12 · In your browser
Guide example · Run to view results.
| values_list | empty_list |
|---|---|
[1, 2, 3] | [] |
Watch for: Use generate_series() when the stop value should be included. Put range() in FROM to generate rows instead of a list.
Example
Haybarn WASM 2.0.0-rc12 · In your browser
Engine example · Run to view results.
In a query
Make a small dataset from nothing.
A table function produces rows you can query. range starts at zero and stops before the upper bound.
Haybarn WASM 2.0.0-rc12 · In your browser
Guide recipe · Run to view results.
In other engines
Snowflakearray_generate_range()
ARRAY_GENERATE_RANGE(0, 3)
RANGE(0, 3)