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

     1  select * from metadata_scan('table_func_metadata_scan.no_exist_table', '*') g;
     2  drop table if exists t;
     3  create table t(a int, b varchar, c float, d decimal(10, 8), e float(5, 2));
     4  insert into t values(1, null, 1.1, 1, 1.11);
     5  insert into t values(2, "abc", 2.0, 2, 2.22);
     6  insert into t select * from t;
     7  insert into t select * from t;
     8  insert into t select * from t;
     9  insert into t select * from t;
    10  insert into t select * from t;
    11  insert into t select * from t;
    12  insert into t select * from t;
    13  insert into t select * from t;
    14  insert into t select * from t;
    15  insert into t select * from t;
    16  insert into t select * from t;
    17  insert into t select * from t;
    18  select count(*) from t;
    19  -- @separator:table
    20  select mo_ctl('dn', 'flush', 'table_func_metadata_scan.t');
    21  select count(*) from metadata_scan('table_func_metadata_scan.t', '*') g;
    22  select count(*) from metadata_scan('table_func_metadata_scan.t', 'a') g;
    23  select count(*) from metadata_scan('table_func_metadata_scan.t', 'f') g;
    24  select col_name, rows_cnt, null_cnt, origin_size from metadata_scan('table_func_metadata_scan.t', 'a') g;
    25  -- @ignore:2,3
    26  select col_name, rows_cnt, null_cnt, origin_size from metadata_scan('table_func_metadata_scan.t', '*') g;
    27  -- @ignore:0
    28  select sum(origin_size) from metadata_scan('table_func_metadata_scan.t', '*') g;
    29  select min(bit_cast(`min` as int)), max(bit_cast(`max` as int)), sum(bit_cast(`sum` as bigint)) from metadata_scan('table_func_metadata_scan.t', 'a') g;
    30  select sum(bit_cast(`sum` as double)) from metadata_scan('table_func_metadata_scan.t', 'c') g;
    31  select sum(c) from t;
    32  select sum(bit_cast(`sum` as decimal(10, 8))) from metadata_scan('table_func_metadata_scan.t', 'd') g;
    33  select sum(d) from t;
    34  select sum(bit_cast(`sum` as double)) from metadata_scan('table_func_metadata_scan.t', 'e') g;
    35  select sum(e) from t;
    36  
    37  select approx_count(*) from t;
    38  insert into t select * from t;
    39  insert into t select * from t;
    40  -- @separator:table
    41  select mo_ctl('dn', 'flush', 'table_func_metadata_scan.t');
    42  select approx_count(*) from t;
    43  
    44  drop table if exists t;
    45  
    46  -- int max value + 1, not overflow
    47  -- bigint max value + 1, overflow
    48  create table t(a int, b bigint);
    49  insert into t values(2147483647, 9223372036854775807);
    50  insert into t values(1, 1);
    51  select count(*) from t;
    52  -- @separator:table
    53  select mo_ctl('dn', 'flush', 'table_func_metadata_scan.t');
    54  select bit_cast(`sum` as bigint) from metadata_scan('table_func_metadata_scan.t', 'a') g;
    55  select sum(a) from t;
    56  select bit_cast(`sum` as bigint) from metadata_scan('table_func_metadata_scan.t', 'b') g;
    57  select sum(b) from t;
    58  -- @separator:table
    59  drop table if exists t;