This topic describes how to use the table-valued function GENERATE_SERIES in Realtime Compute.

Syntax

GENERATE_SERIES(INT from, INT to)

Input parameters

Parameter Data type
from The lower boundary of a consecutive series of values (including the lower boundary) to be generated. This parameter is of the INT type.
to The upper boundary of a consecutive series of values (excluding the upper boundary) to be generated. This parameter is of the INT type.

Description

Generates a consecutive series of values, such as values from the lower boundary to the upper boundary minus one.

Example

  • Test data
    s (INT) e (INT)
    1 3
    -2 1
  • Test statements
    SELECT s, e, v 
    FROM T1, lateral table(GENERATE_SERIES(s, e)) 
    as T(v);             
  • Test results
    s (INT) e (INT) v (INT)
    1 3 1
    1 3 2
    -2 1 -2
    -2 1 -1
    -2 1 -0