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

     1  select field('Bb', 'Aa', 'Bb', 'Cc', 'Dd', 'Ff');
     2  field(Bb, Aa, Bb, Cc, Dd, Ff)
     3  2
     4  select field('Gg', 'Aa', 'Bb', 'Cc', 'Dd', 'Ff');
     5  field(Gg, Aa, Bb, Cc, Dd, Ff)
     6  0
     7  select field('aa', 'AA', 'BB','Aa', 'aA');
     8  field(aa, AA, BB, Aa, aA)
     9  1
    10  select field(' ', 'a', ' ', '\t', '\n');
    11  field( , a,  , \t, \n)
    12  2
    13  select field('', ' ', NULL, '\r', '\n');
    14  field(,  , null, \r, \n)
    15  0
    16  select field('', '', '\r', '\n');
    17  field(, , \r, \n)
    18  1
    19  select field(1, '1', 1, 'true');
    20  strconv.ParseFloat: parsing "true": invalid syntax
    21  select field(1, 1, 2, 3-2);
    22  field(1, 1, 2, 3 - 2)
    23  1
    24  select field(1, 3-2, 2, 1);
    25  field(1, 3 - 2, 2, 1)
    26  1
    27  select field(1, 1.0, 2, 1);
    28  field(1, 1.0, 2, 1)
    29  1
    30  select field(1+1, 1, 2, 3, 1+1);
    31  field(1 + 1, 1, 2, 3, 1 + 1)
    32  2
    33  drop table if exists t;
    34  create table t(
    35  i int,
    36  f float,
    37  d double
    38  );
    39  insert into t() values (1, 1.1, 2.2), (2, 3.3, 4.4), (0, 0, 0), (0, null, 0);
    40  select * from t;
    41  i    f    d
    42  1    1.1    2.2
    43  2    3.3    4.4
    44  0    0.0    0.0
    45  0    null    0.0
    46  select field(1, i, f, d) from t;
    47  field(1, i, f, d)
    48  1
    49  0
    50  0
    51  0
    52  select field(i, 0, 1, 2) from t;
    53  field(i, 0, 1, 2)
    54  2
    55  3
    56  1
    57  1
    58  select field(i, f, d, 0, 1, 2) from t;
    59  field(i, f, d, 0, 1, 2)
    60  4
    61  5
    62  1
    63  2
    64  select field(null, f, d, 0, 1, 2) from t;
    65  field(null, f, d, 0, 1, 2)
    66  0
    67  0
    68  0
    69  0
    70  select field('1', f, d, 0, 1, 2) from t;
    71  field(1, f, d, 0, 1, 2)
    72  4
    73  4
    74  4
    75  4
    76  select field(3.3, f, d, 0, 1, 2) from t;
    77  field(3.3, f, d, 0, 1, 2)
    78  0
    79  0
    80  0
    81  0
    82  select field(3, f, d, 0, 1, 2) from t;
    83  field(3, f, d, 0, 1, 2)
    84  0
    85  0
    86  0
    87  0
    88  drop table if exists t;
    89  create table t(
    90  str1 char(20),
    91  str2 char(20)
    92  );
    93  insert into t values ('hello','world'), ('jaja','haha'), ('didi','dodo'), ('papa','gaga');
    94  select field(str1, str2) from t;
    95  field(str1, str2)
    96  0
    97  0
    98  0
    99  0
   100  select field(str2, str1) from t;
   101  field(str2, str1)
   102  0
   103  0
   104  0
   105  0
   106  select field(str2, str1, NULL) from t;
   107  field(str2, str1, null)
   108  0
   109  0
   110  0
   111  0
   112  drop table if exists t;
   113  create table t(
   114  str1 varchar(50),
   115  str2 varchar(50),
   116  str3 varchar(50),
   117  str4 varchar(50)
   118  );
   119  insert into t values ('&*()&DJHKSY&F', 'JHKHJD21k..fdai', 'kl;ji*(', '86168907()*&*fd');
   120  insert into t values ('&*()&DJHKSY&F', 'JHKHJD21k..fdaiJHKHJD21k..fdai', 'kl;ji*(', '86168907()*&*fd');
   121  select field(str1, str2, str3, str4) from t;
   122  field(str1, str2, str3, str4)
   123  0
   124  0
   125  select field('1', str1, str2) from t;
   126  field(1, str1, str2)
   127  0
   128  0
   129  select field('&*()&DJHKSY&F', str1, str2) from t;
   130  field(&*()&DJHKSY&F, str1, str2)
   131  1
   132  1
   133  select field('&*()&DJHKSY&F', str1, str2, str3, str4) from t;
   134  field(&*()&DJHKSY&F, str1, str2, str3, str4)
   135  1
   136  1
   137  select field('', str1, str2, str3, str4) from t;
   138  field(, str1, str2, str3, str4)
   139  0
   140  0
   141  drop table if exists t1;
   142  drop table if exists t2;
   143  create table t1(
   144  str1 varchar(50),
   145  str2 varchar(50)
   146  );
   147  create table t2(
   148  str1 varchar(50),
   149  str2 varchar(50)
   150  );
   151  insert into t1 values ('',' '), ('aa', 'Aa'), ('null',null);
   152  insert into t2 values ('','\r'), ('aa', 'AA'), (null, 'null');
   153  select field(t1.str1, t2.str1) from t1 join t2 on t1.str1 = t2.str1;
   154  field(t1.str1, t2.str1)
   155  1
   156  1
   157  select field(t1.str2, t2.str2) from t1 join t2 on t1.str1 = t2.str1;
   158  field(t1.str2, t2.str2)
   159  0
   160  1
   161  select field(t1.str1, t2.str1) from t1 left join t2 on t1.str1 = t2.str1;
   162  field(t1.str1, t2.str1)
   163  1
   164  1
   165  0
   166  select field(t1.str1, t2.str1) from t1 right join t2 on t1.str1 = t2.str1;
   167  field(t1.str1, t2.str1)
   168  1
   169  1
   170  0
   171  drop table if exists t1;
   172  drop table if exists t2;
   173  create table t1(
   174  str1 char(50),
   175  str2 char(50),
   176  primary key (str1)
   177  );
   178  create table t2(
   179  str1 char(50),
   180  str2 char(50),
   181  primary key (str1)
   182  );
   183  insert into t1 values ('',' '), ('aa', 'Aa'), ('null',NULL);
   184  insert into t2 values ('','\r'), ('aa', 'AA'), ('null', '');
   185  select field(t1.str1, t2.str1) from t1 inner join t2 on t1.str1 = t2.str1;
   186  field(t1.str1, t2.str1)
   187  1
   188  1
   189  1
   190  select field(null, '');
   191  field(null, )
   192  0
   193  select field(t1.str2, t2.str2) from t1 join t2 on t1.str1 = t2.str1;
   194  field(t1.str2, t2.str2)
   195  0
   196  0
   197  1
   198  drop table if exists t1;
   199  drop table if exists t2;
   200  create table t1(
   201  i int,
   202  f float,
   203  d double,
   204  primary key (i)
   205  );
   206  create table t2(
   207  i int,
   208  f float,
   209  d double,
   210  primary key (i)
   211  );
   212  insert into t1 values (9999999, 999.999, 888.888), (0, 0.0, 0.00);
   213  insert into t2 values (9999999, 999.999, 888.888), (0, 0, 0);
   214  select field(t1.i, t2.i) from t1 inner join t2 on t1.i = t2.i;
   215  field(t1.i, t2.i)
   216  1
   217  1
   218  select field(t1.d, t2.d) from t1 left join t2 on t1.d = t2.d;
   219  field(t1.d, t2.d)
   220  1
   221  1
   222  select field(t1.f, t2.f) from t1 right join t2 on t1.f = t2.f;
   223  field(t1.f, t2.f)
   224  1
   225  1
   226  select field(t1.f, t2.d) from t1 right join t2 on t1.f = t2.f;
   227  field(t1.f, t2.d)
   228  0
   229  1
   230  select field(t1.i, t2.f) from t1 right join t2 on t1.f = t2.f;
   231  field(t1.i, t2.f)
   232  0
   233  1
   234  drop table if exists t1;
   235  drop table if exists t2;
   236  create table t1(
   237  i double,
   238  f decimal(6,3),
   239  primary key (i)
   240  );
   241  create table t2(
   242  i double,
   243  f decimal(6,3),
   244  primary key (i)
   245  );
   246  insert into t1 values (0.01, 0.001), (0.0, -1), (-0.000000001, 1);
   247  insert into t2 values (0.01, 0.01), (-1.0, -1), (0.000000001, -1);
   248  select field(t1.i, t2.i) from t1 inner join t2 on t1.i = t2.i;
   249  field(t1.i, t2.i)
   250  1
   251  select t2.f, t1.f, field(t2.f, t1.f) from t1 right join t2 on t1.i = t2.i;
   252  f    f    field(t2.f, t1.f)
   253  0.010    0.001    0
   254  -1.000    null    0
   255  -1.000    null    0
   256  select t1.i, t2.f, field(t1.i, t2.f) from t1 left join t2 on t1.i = t2.i;
   257  i    f    field(t1.i, t2.f)
   258  0.01    0.010    1
   259  0.0    null    0
   260  -1.0E-9    null    0