github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/table_func_generate_series.test (about)

     1  # Test int
     2  select * from generate_series(1, 5) g;
     3  select * from generate_series(5, 1) g;
     4  select * from generate_series(1, 5, 2) g;
     5  select * from generate_series(5, 1, -2) g;
     6  select * from generate_series(1, 5, 0) g;
     7  select * from generate_series(1, 5, -1) g;
     8  select * from generate_series(5, 1, 1) g;
     9  select * from generate_series(2147483646, 2147483647,5) g;
    10  select * from generate_series(-2147483645, -2147483648,-2) g;
    11  
    12  # Test bigint
    13  select * from generate_series(2147483647, 2147483649) g;
    14  select * from generate_series(2147483647, 2147483649, 2) g;
    15  select * from generate_series(2147483649, 2147483647, -2) g;
    16  select * from generate_series(2147483647, 2147483649, 0) g;
    17  select * from generate_series(2147483647, 2147483649, -1) g;
    18  select * from generate_series(2147483649, 2147483647, 1) g;
    19  select * from generate_series(9223372036854775806, 9223372036854775807) g;
    20  select * from generate_series(9223372036854775806, 9223372036854775807, 2) g;
    21  select * from generate_series(-9223372036854775805, -9223372036854775807) g;
    22  select * from generate_series(-9223372036854775805, -9223372036854775807,-2) g;
    23  select * from generate_series(-9223372036854775805, cast(-9223372036854775808 as bigint),-2) g;
    24  
    25  # Test datetime
    26  select * from generate_series('2020-02-28 00:00:00','2021-03-01 00:01:00', '1 year') g;
    27  select * from generate_series('2020-02-29 00:00:00','2021-03-01 00:01:00', '1 year') g;
    28  select * from generate_series('2020-02-29 00:00:00','2021-03-01 00:01:00', '1 quarter') g;
    29  select * from generate_series('2020-02-28 00:00:00','2021-03-01 00:01:00', '1 quarter') g;
    30  select * from generate_series('2020-02-29 00:00:00','2021-03-01 00:01:00', '1 month') g;
    31  select * from generate_series('2020-02-28 00:00:00','2021-03-01 00:01:00', '1 month') g;
    32  select * from generate_series('2020-02-29 00:00:00','2020-03-08 00:01:00', '1 week') g;
    33  select * from generate_series('2000-01-01 00:00:00', '2000-01-05 00:00:00','1 day') g;
    34  select * from generate_series('2020-02-29 23:59:59','2020-03-01 00:01:00', '1 hour') g;
    35  select * from generate_series('2020-02-29 23:59:59','2020-03-01 00:01:00', '1 minute') g;
    36  select * from generate_series('2020-02-29 23:59:59','2020-03-01 00:00:10', '1 second') g;
    37  select * from generate_series('2020-02-29 23:59:59.124356','2020-02-29 23:59:59.124360', '1 microsecond') g;
    38  
    39  # Test one parameter
    40  select * from generate_series(5) g;
    41  
    42  # Test split
    43  create table t(a int, b text);
    44  insert into t select result, repeat('foobarzoo', 600) t from generate_series(1, 200000) t;
    45  select count(*) as ttl from t;
    46  drop table t;