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

     1  SELECT hex('\xa7');
     2  hex(xa7)
     3  786137
     4  SELECT unhex('616263');
     5  unhex(616263)
     6  abc
     7  SELECT hex('abc'), unhex('616263');
     8  hex(abc)    unhex(616263)
     9  616263    abc
    10  SELECT to_base64('abc'), from_base64('YWJj');
    11  to_base64(abc)    from_base64(YWJj)
    12  YWJj    abc
    13  SELECT unhex('invalid');
    14  unhex(invalid)
    15  null
    16  SELECT from_base64('invalid');
    17  from_base64(invalid)
    18  null
    19  SELECT TO_BASE64('abc'), FROM_BASE64(TO_BASE64('abc'));
    20  to_base64(abc)    from_base64(to_base64(abc))
    21  YWJj    abc
    22  SELECT HEX('abc'),UNHEX(HEX('abc'));
    23  hex(abc)    unhex(hex(abc))
    24  616263    abc
    25  select to_base64(''),to_base64(NULL);
    26  to_base64()    to_base64(null)
    27      null
    28  select to_base64('@#%#$^jfe12');
    29  to_base64(@#%#$^jfe12)
    30  QCMlIyReamZlMTI=
    31  select to_base64(123dokgr);
    32  invalid input: column 123dokgr does not exist
    33  select to_base64(-123);
    34  to_base64(-123)
    35  LTEyMw==
    36  select to_base64(2003-09-06);
    37  to_base64(2003 - 9 - 6)
    38  MTk4OA==
    39  select to_base64('2003-09-06');
    40  to_base64(2003-09-06)
    41  MjAwMy0wOS0wNg==
    42  select to_base64('数据库');
    43  to_base64(数据库)
    44  5pWw5o2u5bqT
    45  select from_base64(''),from_base64(NULL);
    46  from_base64()    from_base64(null)
    47      null
    48  select from_base64('@#%#$^jfe12');
    49  from_base64(@#%#$^jfe12)
    50  null
    51  select from_base64(123dokgr);
    52  invalid input: column 123dokgr does not exist
    53  select from_base64(-123);
    54  from_base64(-123)
    55  null
    56  select from_base64(2003-09-06);
    57  from_base64(2003 - 9 - 6)
    58  ��<
    59  select from_base64('5pWw5o2u5bqT');
    60  from_base64(5pWw5o2u5bqT)
    61  数据库
    62  select from_base64('MjAwMy0wOS0wNg==');
    63  from_base64(MjAwMy0wOS0wNg==)
    64  2003-09-06
    65  create table test_base(c1 varchar(25));
    66  insert into test_base values(to_base64('blue')),(to_base64('232525')),(to_base64('lijfe23253'));
    67  select from_base64(c1) from test_base;
    68  from_base64(c1)
    69  blue
    70  232525
    71  lijfe23253
    72  CREATE TABLE t1 (name varchar(255), age int);
    73  INSERT INTO t1 (name, age) VALUES ('Abby', 24);
    74  INSERT INTO t1 (age) VALUES (25);
    75  INSERT INTO t1 (name, age) VALUES ('Carol', 23);
    76  SELECT * FROM t1;
    77  name    age
    78  Abby    24
    79  null    25
    80  Carol    23
    81  SELECT serial(name,age) from t1;
    82  serial(name, age)
    83  FAbby:
    84  null
    85  FCarol:
    86  SELECT serial_full(name,age) from t1;
    87  serial_full(name, age)
    88  FAbby:
    89  :
    90  FCarol:
    91  SELECT serial_extract(serial(1,2), 0 as bigint);
    92  serial_extract(serial(1, 2), 0 as bigint)
    93  1
    94  SELECT serial_extract(serial(1,2), 1 as bigint);
    95  serial_extract(serial(1, 2), 1 as bigint)
    96  2
    97  SELECT serial_extract(serial(1,2), 2 as bigint); -- error
    98  internal error: index out of range
    99  SELECT serial_extract(serial(1,"adam"), 1 as varchar(4));
   100  serial_extract(serial(1, adam), 1 as varchar(4))
   101  adam
   102  SELECT serial_extract(serial(1,"adam"), 1 as varchar(255));
   103  serial_extract(serial(1, adam), 1 as varchar(255))
   104  adam
   105  SELECT serial_extract(serial(1,cast("[1,2,3]" as vecf32(3))), 1 as vecf32(3));
   106  serial_extract(serial(1, cast([1,2,3] as vecf32(3))), 1 as vecf32(3))
   107  [1, 2, 3]
   108  SELECT serial_extract(serial(cast(2.45 as float),cast(3 as bigint)), 0 as float);
   109  serial_extract(serial(cast(2.45 as float), cast(3 as bigint)), 0 as float)
   110  2.45
   111  SELECT serial_extract(serial(cast(2.45 as float),cast(3 as bigint)), 1 as bigint);
   112  serial_extract(serial(cast(2.45 as float), cast(3 as bigint)), 1 as bigint)
   113  3
   114  SELECT serial_extract(serial(NULL, cast(1 as bigint)), 1 as bigint); -- serial NULL
   115  serial_extract(serial(null, cast(1 as bigint)), 1 as bigint)
   116  null
   117  SELECT serial_extract(serial_full(NULL, cast(1 as bigint)), 1 as bigint); -- serial_full
   118  serial_extract(serial_full(null, cast(1 as bigint)), 1 as bigint)
   119  1
   120  SELECT serial_extract(serial_full(NULL, cast(1 as bigint)), 0 as varchar(1)); -- serial_full (data type doesn't matter for NULL)
   121  serial_extract(serial_full(null, cast(1 as bigint)), 0 as varchar(1))
   122  null
   123  SELECT serial_extract(serial_full(NULL, 1), 1 as int); -- error
   124  internal error: provided type did not match the expected type
   125  SELECT serial_extract(serial_full(NULL, "adam"), 1 as varchar(4));
   126  serial_extract(serial_full(null, adam), 1 as varchar(4))
   127  adam
   128  SELECT serial_extract(serial_full(NULL, "adam"), 1 as vecf32(4));
   129  serial_extract(serial_full(null, adam), 1 as vecf32(4))
   130  [4359717400000000000000000000]
   131  CREATE TABLE t2 (name varchar(255), age int);
   132  INSERT INTO t2 (name, age) VALUES ('Abby', 24);
   133  INSERT INTO t2 (name,age) VALUES ('Alex',23);
   134  INSERT INTO t2 (name, age) VALUES ('Carol', 23);
   135  INSERT INTO t2 (age) VALUES (25);
   136  select name, age from t2 order by name asc,age asc;
   137  name    age
   138  null    25
   139  Abby    24
   140  Alex    23
   141  Carol    23
   142  SELECT min( serial(t2.name, t2.age)) from t2;
   143  min(serial(t2.name, t2.age))
   144  FAbby:
   145  SELECT min( serial_full(t2.name,t2.age)) from t2;
   146  min(serial_full(t2.name, t2.age))
   147  :
   148  select  serial_extract(min, 0 as varchar(255)),  serial_extract(min, 1 as int) from (SELECT min( serial_full(t2.name,t2.age)) as min from t2);
   149  serial_extract(min, 0 as varchar(255))    serial_extract(min, 1 as int)
   150  null    25
   151  select age,name from t2 order by age asc,name asc;
   152  age    name
   153  23    Alex
   154  23    Carol
   155  24    Abby
   156  25    null
   157  SELECT min( serial(t2.age,t2.name)) from t2;
   158  min(serial(t2.age, t2.name))
   159  :FAlex
   160  SELECT min( serial_full(t2.age,t2.name)) from t2;
   161  min(serial_full(t2.age, t2.name))
   162  :FAlex
   163  select  serial_extract(min, 0 as int),  serial_extract(min, 1 as varchar(255)) from (SELECT min( serial_full(t2.age,t2.name)) as min from t2);
   164  serial_extract(min, 0 as int)    serial_extract(min, 1 as varchar(255))
   165  23    Alex
   166  select name, age from t2 order by name desc,age desc;
   167  name    age
   168  Carol    23
   169  Alex    23
   170  Abby    24
   171  null    25
   172  SELECT max( serial(t2.name, t2.age)) from t2;
   173  max(serial(t2.name, t2.age))
   174  FCarol:
   175  SELECT max( serial_full(t2.name,t2.age)) from t2;
   176  max(serial_full(t2.name, t2.age))
   177  FCarol:
   178  select  serial_extract(max, 0 as varchar(255)),  serial_extract(max, 1 as int) from (SELECT max( serial_full(t2.name,t2.age)) as max from t2);
   179  serial_extract(max, 0 as varchar(255))    serial_extract(max, 1 as int)
   180  Carol    23
   181  select age,name from t2 order by age desc,name desc;
   182  age    name
   183  25    null
   184  24    Abby
   185  23    Alex
   186  23    Carol
   187  SELECT max( serial(t2.age,t2.name)) from t2;
   188  max(serial(t2.age, t2.name))
   189  :FAbby
   190  SELECT max( serial_full(t2.age,t2.name)) from t2;
   191  max(serial_full(t2.age, t2.name))
   192  :
   193  select  serial_extract(max, 0 as int),  serial_extract(max, 1 as varchar(255)) from (SELECT max( serial_full(t2.age,t2.name)) as max from t2);
   194  serial_extract(max, 0 as int)    serial_extract(max, 1 as varchar(255))
   195  25    null
   196  drop table if exists test01;
   197  create table test01 (col1 bigint, col2 varchar(10), col3 char);
   198  insert into test01 values (1392034, 'database', 'a');
   199  insert into test01 values (23849242, 'abcdai', 'b');
   200  insert into test01 values (-32934, 'mo', 'c');
   201  insert into test01 values (null, null, null);
   202  select * from test01;
   203  col1    col2    col3
   204  1392034    database    a
   205  23849242    abcdai    b
   206  -32934    mo    c
   207  null    null    null
   208  select serial(col1, col2) from test01;
   209  serial(col1, col2)
   210  ;=�Fdatabase
   211  ;k�Fabcdai
   212  ;YFmo
   213  null
   214  select serial(col1, col2, col3) from test01;
   215  serial(col1, col2, col3)
   216  ;=�FdatabaseFa
   217  ;k�FabcdaiFb
   218  ;YFmoFc
   219  null
   220  select serial_full(col1, col2, col3) from test01;
   221  serial_full(col1, col2, col3)
   222  ;=�FdatabaseFa
   223  ;k�FabcdaiFb
   224  ;YFmoFc
   225  
   226  select serial_full(col1, col3) from test01;
   227  serial_full(col1, col3)
   228  ;=�Fa
   229  ;k�Fb
   230  ;YFc
   231  
   232  select max(serial(col1, col2)) from test01;
   233  max(serial(col1, col2))
   234  ;k�Fabcdai
   235  select max(serial(col1, col2, col3)) from test01;
   236  max(serial(col1, col2, col3))
   237  ;k�FabcdaiFb
   238  select min(serial_full(col1, col2, col3)) from test01;
   239  min(serial_full(col1, col2, col3))
   240  
   241  select min(serial_full(col1, col3)) from test01;
   242  min(serial_full(col1, col3))
   243  
   244  drop table test01;
   245  drop table if exists test02;
   246  create table test02 (col1 int, col2 decimal, col3 char);
   247  insert into test02 values (1,2,'a');
   248  insert into test02 values (2,3,'b');
   249  insert into test02 values (null, null, null);
   250  select * from test02;
   251  col1    col2    col3
   252  1    2    a
   253  2    3    b
   254  null    null    null
   255  select serial_extract(max(serial(col1, col2, col3)), 1 as decimal) from test02;
   256  serial_extract(max(serial(col1, col2, col3)), 1 as decimal(38))
   257  3
   258  select serial_extract(min(serial(col1, col2, col3)), 1 as decimal) from test02;
   259  serial_extract(min(serial(col1, col2, col3)), 1 as decimal(38))
   260  2
   261  select serial_extract(max(serial_full(cast(col1 as decimal), cast(col2 as double))), 0 as decimal) from test02;
   262  serial_extract(max(serial_full(cast(col1 as decimal(38)), cast(col2 as double))), 0 as decimal(38))
   263  2
   264  select serial_extract(min(serial_full(cast(col1 as decimal), cast(col2 as double))), 0 as decimal) from test02;
   265  serial_extract(min(serial_full(cast(col1 as decimal(38)), cast(col2 as double))), 0 as decimal(38))
   266  null
   267  drop table test02;
   268  drop table if exists vtab64;
   269  create table vtab64(id int primary key auto_increment,`vecf64_3` vecf64(3),`vecf64_5` vecf64(5));
   270  insert into vtab64(vecf64_3,vecf64_5) values("[0.8166459,NULL,0.4886152]",NULL);
   271  internal error: error while casting NULL to DOUBLE
   272  insert into vtab64(vecf64_3,vecf64_5) values(NULL,NULL);
   273  insert into vtab64(vecf64_3,vecf64_5) values("[0.8166459,0.66616553,0.4886152]",NULL);
   274  insert into vtab64(vecf64_3,vecf64_5) values ("[8.5606893,6.7903588,821.977768]","[0.46323407,23.49801546,563.9229458,56.07673508,8732.9583881]");
   275  insert into vtab64(vecf64_3,vecf64_5) values ("[0.9260021,0.26637346,0.06567037]","[0.45756745,65.2996871,321.623636,3.60082066,87.58445764]");
   276  select * from vtab64;
   277  id    vecf64_3    vecf64_5
   278  1    null    null
   279  2    [0.8166459, 0.66616553, 0.4886152]    null
   280  3    [8.5606893, 6.7903588, 821.977768]    [0.46323407, 23.49801546, 563.9229458, 56.07673508, 8732.9583881]
   281  4    [0.9260021, 0.26637346, 0.06567037]    [0.45756745, 65.2996871, 321.623636, 3.60082066, 87.58445764]
   282  select serial_extract(max(serial(id, `vecf64_3`, `vecf64_5`)), 1 as vecf64(3)) from vtab64;
   283  serial_extract(max(serial(id, vecf64_3, vecf64_5)), 1 as vecf64(3))
   284  [0.9260021, 0.26637346, 0.06567037]
   285  select serial_extract(min(serial(id, `vecf64_3`, `vecf64_5`)), 1 as vecf64(3)) from vtab64;
   286  serial_extract(min(serial(id, vecf64_3, vecf64_5)), 1 as vecf64(3))
   287  [8.5606893, 6.7903588, 821.977768]
   288  select serial_extract(max(serial_full(cast(id as decimal), `vecf64_3`)), 0 as decimal) from vtab64;
   289  serial_extract(max(serial_full(cast(id as decimal(38)), vecf64_3)), 0 as decimal(38))
   290  4
   291  select serial_extract(min(serial_full(cast(id as decimal), `vecf64_3`)), 1 as vecf64(3)) from vtab64;
   292  serial_extract(min(serial_full(cast(id as decimal(38)), vecf64_3)), 1 as vecf64(3))
   293  null
   294  drop table vtab64;