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

     1  #SELECT, 嵌套
     2  select log2(log2(256)),log2(log2(2));
     3  
     4  #SELECT
     5  SELECT log2(1024);
     6  SELECT log2(-1024);
     7  SELECT log2(0);
     8  
     9  
    10  #EXTREME VALUE, 科学计数
    11  
    12  select log2(0.00000000000000001);
    13  select log2(2e2);
    14  select log2(0.141241241241313);
    15  select log2(-124314124124.12412341);
    16  
    17  
    18  #NULL
    19  select log2(null);
    20  
    21  #INSERT
    22  CREATE TABLE t1(a DOUBLE);
    23  INSERT INTO t1 select (log2(56));
    24  INSERT INTO t1 select (log2(100));
    25  SELECT * FROM t1 ORDER BY a;
    26  drop table t1;
    27  
    28  #DATATYPE
    29  create table t1(a tinyint, b SMALLINT, c bigint, d INT, e BIGINT, f FLOAT, g DOUBLE, h decimal(38,19));
    30  insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314);
    31  select log2(a),log2(b),log2(c),log2(d),log2(e),log2(f),log2(g),log2(h) from t1;
    32  drop table t1;
    33  
    34  #算术操作
    35  select log2(123.54-123.03);
    36  select log2(123.54*0.34);
    37  select log2(134)-log2(194);
    38  
    39  
    40  #WHERE,distinct
    41  drop table if exists t1;
    42  create table t1(a int);
    43  insert into t1 values(10), (100);
    44  select distinct * from t1 where log2(a)>0;
    45  drop table t1;
    46  
    47  #ON CONDITION
    48  create table t1(a INT, b int);
    49  create table t2(a INT, b int);
    50  insert into t1 values(2,4), (100,23);
    51  insert into t2 values(10,100), (4,41);
    52  SELECT t1.a, t2.a FROM t1 JOIN t2 ON (log2(t1.a) <> log2(t2.a));
    53  drop table t1;
    54  drop table t2;
    55  
    56  
    57  
    58  #HAVING,比较操作
    59  drop table if exists t1;
    60  create table t1(a float,  b float);
    61  insert into t1 values(14.413, 43.413), (8.123, 0.409);
    62  select b from t1 group by b having log2(b)>0;
    63  drop table t1;