sequence
function
Applies to: Databricks SQL Databricks Runtime
Generates an array of elements from start
to stop
(inclusive), incrementing by step
.
Arguments
start
: An expression of an integral numeric type,DATE
, orTIMESTAMP
.stop
: Ifstart
is numeric an integral numeric, aDATE
orTIMESTAMP
otherwise.step
: AnINTERVAL
expression ifstart
is aDATE
orTIMESTAMP
, or an integral numeric otherwise.
Returns
An ARRAY
of least common type of start
and stop
.
By default step
is 1 if start
is less than or equal to stop
, otherwise -1.
For the DATE
or TIMESTAMP
sequences default step
is INTERVAL
‘1’ DAY and INTERVAL
‘-1’ DAY
respectively.
If start
is greater than stop
then step
must be negative, and vice versa.