github.com/matrixorigin/matrixone@v0.7.0/test/distributed/cases/function/func_string_space.test (about)

     1  #SELECT, 嵌套
     2  
     3  drop table if exists t1;
     4  create table t1 (
     5  name varchar(10),
     6  level smallint unsigned);
     7  insert into t1 values ('string',1);
     8  select reverse("123"+space(level)+"456") from t1;
     9  select concat_ws("abc", name,space(level)), concat_ws("abc",name, space(level)) from t1;
    10  drop table t1;
    11  
    12  
    13  #DATETYPE, INSERT
    14  create table t1 (a varchar(16383));
    15  insert into t1 select space(50000);
    16  select length(a) from t1;
    17  drop table t1;
    18  
    19  #嵌套,EXTREME VALUE
    20  -- @separator:table
    21  select space(5),concat_ws('*',space(5),'*');
    22  select space(-1);
    23  select space(-4294967295);
    24  select space(4294967295);
    25  select space(-4294967296);
    26  select space(4294967296);
    27  select space(-4294967297);
    28  select space(4294967297);
    29  select space(-18446744073709551615);
    30  
    31  select space(18446744073709551615);
    32  
    33  select space(-18446744073709551616);
    34  -- @bvt:issue#3743
    35  select space(18446744073709551616);
    36  -- @bvt:issue
    37  select space(-18446744073709551617);
    38  -- @bvt:issue#3743
    39  select space(18446744073709551617);
    40  -- @bvt:issue
    41  
    42  
    43  SELECT space(9223372036854775808);
    44  SELECT length(space(9223372036854775809));
    45  
    46  #NULL
    47  SELECT SPACE(NULL);
    48  
    49  #DATE TYPE
    50  -- @separator:table
    51  SELECT SPACE(12)+"123";
    52  SELECT SPACE(12314.14123)+"123";
    53  -- @separator:table
    54  SELECT SPACE("1231")+"123";
    55  SELECT SPACE("2012-03-12")+"123";
    56  
    57  #EXTREME VALUE, 嵌套
    58  CREATE TABLE t(i BIGINT UNSIGNED);
    59  INSERT INTO t values(9223372036854775808);
    60  SELECT space(i) FROM t;
    61  DROP TABLE t;
    62  
    63  SELECT space(1073741824);
    64  SELECT TO_DATE(SPACE(2),'1');
    65  
    66  #HAVING & 算术运算
    67  drop table if exists t1;
    68  create table t1(a INT);
    69  insert into t1 values(1),(1),(2),(3);
    70  select a from t1 group by a having space(a)="   ";
    71  drop table t1;
    72  
    73  #WHERE
    74  drop table if exists t1;
    75  create table t1(a INT,  b date);
    76  insert into t1 values(1, "2012-10-12"),(2, "2004-04-24"),(3, "2008-12-04"),(4, "2012-03-23");
    77  select * from t1 where space(a)=" ";
    78  drop table t1;
    79  
    80  #DISTINCT,ON CONDITION
    81  drop table if exists t1;
    82  drop table if exists t2;
    83  create table t1(a INT,  b date);
    84  create table t2(a INT,  b date);
    85  insert into t1 values(1, "2012-10-12"),(1, "2004-04-24"),(3, "2008-12-04"),(4, "2012-03-23");
    86  insert into t2 values(1, "2013-04-30"),(1, "1994-10-04"),(3, "2018-06-04"),(4, "2012-10-12");
    87  SELECT distinct t1.a, t2.a FROM t1 JOIN t2 ON (space(t1.a) = space(t2.a));
    88  drop table t1;
    89  drop table t2;
    90  
    91  #中文
    92  SELECT space("你好")+"你好";