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

     1  #SELECT, 嵌套
     2  select log(exp(10)),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
     3  
     4  #0.5 sqrt函数暂不支持
     5  #select exp(log(sqrt(10))*2);
     6  
     7  #SELECT
     8  SELECT LOG(2);
     9  SELECT LOG(-2);
    10  
    11  SELECT LOG(2,65536);
    12  SELECT LOG(10,100);
    13  SELECT LOG(1,100);
    14  
    15  
    16  #EXTREME VALUE,科学计数
    17  
    18  select log(2,-1);
    19  select log(-2,1);
    20  
    21  
    22  select log(0.00000000000000001);
    23  select log(10e100);
    24  
    25  
    26  select log(0.141241241241313, 124314124124.12412341);
    27  select log(-0.141241241241313, -124314124124.12412341);
    28  
    29  
    30  
    31  #NULL
    32  
    33  
    34  select log(null,2);
    35  select log(2, null);
    36  select log(null,null);
    37  
    38  
    39  #INSERT
    40  
    41  CREATE TABLE t1(a DOUBLE);
    42  INSERT INTO t1 select (log(56));
    43  INSERT INTO t1 select (log(10,100));
    44  INSERT INTO t1 select (log(2,4));
    45  SELECT * FROM t1 ORDER BY a;
    46  drop table t1;
    47  
    48  
    49  #DATATYPE
    50  
    51  create table t1(a tinyint, b SMALLINT, c bigint, d INT, e BIGINT, f FLOAT, g DOUBLE, h decimal(38,19), i DATE, k datetime, l TIMESTAMP, m char(255), n varchar(255));
    52  insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf");
    53  select log(a),log(b),log(c),log(d),log(e),log(f),log(g),log(h),log(i),log(k),log(l),log(m),log(n) from t1;
    54  select log(a,b), log(b,c),log(c,d),log(d,e),log(e,f),log(f,g),log(g,h), log(h,i), log(i,k),log(k,l),log(l,m),log(m,n) from t1;
    55  drop table t1;
    56  
    57  
    58  #0.5暂不支持time类型
    59  #create table t1(a time)
    60  #insert into t1 values("10:03:12");
    61  #select log(a) from t1;
    62  #drop table t1;
    63  
    64  #算术操作
    65  
    66  select log(123.54-123.03);
    67  select log(123.54*0.34, 1203-1200);
    68  select log(134)-log(194);
    69  
    70  
    71  #WHERE,distinct
    72  drop table if exists t1;
    73  create table t1(a float,  b float);
    74  insert into t1 values(10, 100), (100, 1000);
    75  select distinct * from t1 where log(a, b)=2;
    76  drop table t1;
    77  
    78  
    79  #ON CONDITION
    80  create table t1(a INT, b int);
    81  create table t2(a INT, b int);
    82  insert into t1 values(2,4), (100,23);
    83  insert into t2 values(10,100), (4,41);
    84  SELECT t1.a, t2.a FROM t1 JOIN t2 ON (log(t1.a, t1.b) = log(t2.a, t2.b));
    85  drop table t1;
    86  drop table t2;
    87  
    88  
    89  
    90  #HAVING,比较操作
    91  drop table if exists t1;
    92  create table t1(a float,  b float);
    93  insert into t1 values(14124.413, 4213.413), (984798.123, 980.409);
    94  select b from t1 group by b having log(b)>0;
    95  drop table t1;
    96