From b6cc4edc70e3b8b1825a13bab274ee241fd5a7ed Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Wed, 8 Dec 2021 16:24:30 +0800 Subject: [PATCH] add pow/log test cases --- .../{math_str_func.sim => math_funcs.sim} | 7 +- tests/script/general/compute/math_log.sim | 818 ++++++++++++++++++ tests/script/general/compute/math_log2.sim | 126 +++ tests/script/general/compute/math_pow.sim | 818 ++++++++++++++++++ tests/script/general/compute/math_pow2.sim | 126 +++ 5 files changed, 1894 insertions(+), 1 deletion(-) rename tests/script/general/compute/{math_str_func.sim => math_funcs.sim} (97%) create mode 100644 tests/script/general/compute/math_log.sim create mode 100644 tests/script/general/compute/math_log2.sim create mode 100644 tests/script/general/compute/math_pow.sim create mode 100644 tests/script/general/compute/math_pow2.sim diff --git a/tests/script/general/compute/math_str_func.sim b/tests/script/general/compute/math_funcs.sim similarity index 97% rename from tests/script/general/compute/math_str_func.sim rename to tests/script/general/compute/math_funcs.sim index d40d387248..0912595655 100644 --- a/tests/script/general/compute/math_str_func.sim +++ b/tests/script/general/compute/math_funcs.sim @@ -53,6 +53,8 @@ run general/compute/math_atan.sim run general/compute/math_sin.sim run general/compute/math_cos.sim run general/compute/math_tan.sim +run general/compute/math_pow.sim +run general/compute/math_log.sim sql create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double); @@ -120,6 +122,9 @@ run general/compute/math_cos.sim run general/compute/math_cos2.sim run general/compute/math_tan.sim run general/compute/math_tan2.sim - +run general/compute/math_pow.sim +run general/compute/math_pow2.sim +run general/compute/math_log.sim +run general/compute/math_log2.sim #system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/compute/math_log.sim b/tests/script/general/compute/math_log.sim new file mode 100644 index 0000000000..d8bb47d698 --- /dev/null +++ b/tests/script/general/compute/math_log.sim @@ -0,0 +1,818 @@ +sleep 100 +sql connect +sql use db + +print execute sql select log(c2,*) from tb1; +sql_error select log(c2,*) from tb1; +print execute sql select log(c2,*) from tb1; +sql_error select log(c2,*) from tb1; +print execute sql select log(c2,*) from tb1; +sql_error select log(c2,*) from tb1; +print execute sql select log(c2,*) from tb1; +sql_error select log(c2,*) from tb1; +print execute sql select log(c2,*) as a from tb1; +sql_error select log(c2,*) as a from tb1; +print execute sql select log(c2,*) + 1 as a from tb1; +sql_error select log(c2,*) + 1 as a from tb1; +print execute sql select log(c2,tb1.*) + 1 as a from tb1; +sql_error select log(c2,tb1.*) + 1 as a from tb1; +print execute sql select log(c2,*) from tb1; +sql_error select log(c2,*) from tb1; +print execute sql select log(c2,c1) from tb1; +sql_error select log(c2,c1) from tb1; +print execute sql select log(c2,c1) from tb1; +sql_error select log(c2,c1) from tb1; +print execute sql select log(c2,c1 + c2) from tb1; +sql_error select log(c2,c1 + c2) from tb1; +print execute sql select log(c2,13) from tb1; +sql select log(c2,13) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.270238154@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.540476309@ then + return -1 +endi +if $data50 != @1.888609252@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c1) from tb1; +sql_error select log(c2,c1) from tb1; +print execute sql select log(c2,c2) from tb1; +sql select log(c2,c2) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @1.000000000@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c3) from tb1; +sql select log(c2,c3) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.465913680@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c4) from tb1; +sql select log(c2,c4) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.225441442@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c5) from tb1; +sql select log(c2,c5) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.110931503@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c6) from tb1; +sql select log(c2,c6) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.054599099@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c7) from tb1; +sql select log(c2,c7) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.006824887@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c8) from tb1; +sql_error select log(c2,c8) from tb1; +print execute sql select log(c2,c9) from tb1; +sql_error select log(c2,c9) from tb1; +print execute sql select log(c2,c10) from tb1; +sql select log(c2,c10) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.874822948@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c11) from tb1; +sql select log(c2,c11) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.436793995@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c12) from tb1; +sql select log(c2,c12) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.218396396@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c13) from tb1; +sql select log(c2,c13) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.110931503@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,12345678900000000000000000) from tb1; +sql_error select log(c2,12345678900000000000000000) from tb1; +print execute sql select distinct log(c2,123) from tb1; +sql_error select distinct log(c2,123) from tb1; +print execute sql select log(c2,t1) from stb1; +sql_error select log(c2,t1) from stb1; +print execute sql select log(c2,c1),avg(c3) from tb1; +sql_error select log(c2,c1),avg(c3) from tb1; +print execute sql select log(c2,c1),top(c3,1) from tb1; +sql_error select log(c2,c1),top(c3,1) from tb1; +print execute sql select log(c2,c2+c3) from tb1 session(ts, 1s); +sql_error select log(c2,c2+c3) from tb1 session(ts, 1s); +print execute sql select log(c2,c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select log(c2,c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select log(c2,c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select log(c2,c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select log(c2,c2+c3) from stb1 group by t1; +sql_error select log(c2,c2+c3) from stb1 group by t1; +print execute sql select log(c2,c2+c3) from stb1 group by ts; +sql_error select log(c2,c2+c3) from stb1 group by ts; +print execute sql select log(c2,c2+c3) from stb1 group by c1; +sql_error select log(c2,c2+c3) from stb1 group by c1; +print execute sql select log(c2,c2+c3) from stb1 group by tbname; +sql_error select log(c2,c2+c3) from stb1 group by tbname; +print execute sql select log(c2,c2+c3) from tb1 order by c2; +sql_error select log(c2,c2+c3) from tb1 order by c2; +print execute sql select log(c2,c8),log(c2,c9) from tbn; +sql_error select log(c2,c8),log(c2,c9) from tbn; +print execute sql select log(c2,ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select log(c2,ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select log(c2,a) from (select log(c2,c2) as a from tb1); +sql_error select log(c2,a) from (select log(c2,c2) as a from tb1); +print execute sql select log(c2,"abc") from tb1; +sql_error select log(c2,"abc") from tb1; +print execute sql select log(c2,c2 + c3) from tb1; +sql select log(c2,c2 + c3) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.666666667@ then + return -1 +endi +if $data50 != @0.465740397@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,(c2 + c3)) from tb1; +sql select log(c2,(c2 + c3)) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.666666667@ then + return -1 +endi +if $data50 != @0.465740397@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,(c2 * c3)+c4-6) from tb1; +sql select log(c2,(c2 * c3)+c4-6) from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.525299070@ then + return -1 +endi +if $data50 != @0.225421132@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,11)+c2 from tb1; +sql select log(c2,11)+c2 from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @2.289064826@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @4.578129653@ then + return -1 +endi +if $data50 != @129.020182925@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c1)+c2 from tb1; +sql_error select log(c2,c1)+c2 from tb1; +print execute sql select log(c2,c2)+11 from tb1; +sql select log(c2,c2)+11 from tb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @12.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @12.000000000@ then + return -1 +endi +if $data50 != @12.000000000@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c1),c1,c2 from tb1; +sql_error select log(c2,c1),c1,c2 from tb1; +print execute sql select log(c2,c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select log(c2,c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select log(c2,c1),floor(c3) from tb1; +sql_error select log(c2,c1),floor(c3) from tb1; +print execute sql select log(c2,c1),log(c2,c2+c3) from tb1; +sql_error select log(c2,c1),log(c2,c2+c3) from tb1; +print execute sql select log(c2,c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select log(c2,c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @0.666666667@ then + return -1 +endi +if $data20 != @0.465740397@ then + return -1 +endi +if $data30 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c2) from tb1 order by ts desc; +sql select log(c2,c2) from tb1 order by ts desc; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @1.000000000@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +print execute sql select log(c2,c2+c3) from tb1 order by ts desc; +sql select log(c2,c2+c3) from tb1 order by ts desc; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @0.465740397@ then + return -1 +endi +if $data20 != @0.666666667@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @NULL@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select log(c2,c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select log(c2,c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @0.666666667@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select log(c2,c2) from stb1; +sql select log(c2,c2) from stb1; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @1.000000000@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data70 != @-nan@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi +print execute sql select log(c2,c2) from stb1 order by ts desc; +sql select log(c2,c2) from stb1 order by ts desc; +if $data00 != @1.000000000@ then + if $data00 != @-nan@ then + return -1 + endi +endi +if $data20 != @1.000000000@ then + if $data20 != @1.000000000@ then + return -1 + endi +endi +if $data40 != @1.000000000@ then + if $data40 != @1.000000000@ then + return -1 + endi +endi +if $data60 != @1.000000000@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @1.000000000@ then + if $data80 != @1.000000000@ then + return -1 + endi +endi +print execute sql select log(c2,c4),t1 from stb1 order by ts desc; +sql select log(c2,c4),t1 from stb1 order by ts desc; +if $data00 != @1.000000000@ then + if $data00 != @-nan@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @1.000000000@ then + if $data20 != @0.225441442@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @1.000000000@ then + if $data40 != @1.000000000@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @1.000000000@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @1.584962501@ then + if $data80 != @1.000000000@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select log(c2,c3),tbname from stb1; +sql select log(c2,c3),tbname from stb1; +if $data00 != @-nan@ then + return -1 +endi +if $data01 != @tb1@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @tb1@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @tb1@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @0.465913680@ then + return -1 +endi +if $data51 != @tb1@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data61 != @tb1@ then + return -1 +endi +if $data70 != @-nan@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select log(c2,c3),tbname from stb1 where t1 > 1; +sql select log(c2,c3),tbname from stb1 where t1 > 1; +if $data00 != @-nan@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @1.000000000@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @1.000000000@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @1.000000000@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select log(c2,c8),log(c2,c9) from tbn; +sql_error select log(c2,c8),log(c2,c9) from tbn; +print execute sql select log(c2,c8),log(c2,c9) from tbn order by ts desc; +sql_error select log(c2,c8),log(c2,c9) from tbn order by ts desc; +print execute sql select log(c2,log(c2,c8)) from tbn; +sql_error select log(c2,log(c2,c8)) from tbn; +print execute sql select log(c2,a) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select log(c2,a) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select log(c2,c2) from (select * from stb1); +sql select log(c2,c2) from (select * from stb1); +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @1.000000000@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data70 != @-nan@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi +print execute sql select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)); +sql_error select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)); +print execute sql select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts; +sql_error select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts; +print execute sql select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts desc; +sql_error select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts desc; +print execute sql select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a desc; +sql_error select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a desc; +print execute sql select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a; +sql_error select log(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a; +print execute sql select log(c2,a) from (select log(c2,c2) as a from tb1); +sql_error select log(c2,a) from (select log(c2,c2) as a from tb1); +print execute sql select log(c2,tb1.c3),log(c2,tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql_error select log(c2,tb1.c3),log(c2,tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +print execute sql select log(c2,c3) from tb1 union all select log(c2,c3) from tb2; +sql select log(c2,c3) from tb1 union all select log(c2,c3) from tb2; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.465913680@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data70 != @-nan@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi diff --git a/tests/script/general/compute/math_log2.sim b/tests/script/general/compute/math_log2.sim new file mode 100644 index 0000000000..25722ceae1 --- /dev/null +++ b/tests/script/general/compute/math_log2.sim @@ -0,0 +1,126 @@ +sleep 100 +sql connect +sql use db + +print execute sql select log(c2,stb1.c4),log(c2,stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql_error select log(c2,stb1.c4),log(c2,stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +print execute sql select log(c2,c4) as a from stb1 union all select log(c2,c5) as a from stba; +sql select log(c2,c4) as a from stb1 union all select log(c2,c5) as a from stba; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @0.225441442@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data70 != @-nan@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data90 != @1.584962501@ then + return -1 +endi +print execute sql select log(c2,c2) from stba; +sql select log(c2,c2) from stba; +if $data00 != @-nan@ then + return -1 +endi +if $data10 != @1.000000000@ then + return -1 +endi +if $data20 != @1.000000000@ then + return -1 +endi +if $data30 != @1.000000000@ then + return -1 +endi +if $data40 != @1.000000000@ then + return -1 +endi +if $data50 != @1.000000000@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data90 != @-nan@ then + return -1 +endi +print execute sql select log(c2,min(c2)) from tba1; +sql_error select log(c2,min(c2)) from tba1; +print execute sql select log(c2,max(c2)) from tba1; +sql_error select log(c2,max(c2)) from tba1; +print execute sql select log(c2,count(c2)) from tba1; +sql_error select log(c2,count(c2)) from tba1; +print execute sql select log(c2,sum(c2)) from tba1; +sql_error select log(c2,sum(c2)) from tba1; +print execute sql select log(c2,avg(c2)) from tba1; +sql_error select log(c2,avg(c2)) from tba1; +print execute sql select log(c2,percentile(c2, 10)) from tba1; +sql_error select log(c2,percentile(c2, 10)) from tba1; +print execute sql select log(c2,apercentile(c2, 10)) from tba1; +sql_error select log(c2,apercentile(c2, 10)) from tba1; +print execute sql select log(c2,stddev(c2)) from tba1; +sql_error select log(c2,stddev(c2)) from tba1; +print execute sql select log(c2,spread(c2)) from tba1; +sql_error select log(c2,spread(c2)) from tba1; +print execute sql select log(c2,twa(c2)) from tba1; +sql_error select log(c2,twa(c2)) from tba1; +print execute sql select log(c2,leastsquares(c2, 1, 1)) from tba1; +sql_error select log(c2,leastsquares(c2, 1, 1)) from tba1; +print execute sql select log(c2,interp(c2)) from tba1 every(1s) +sql_error select log(c2,interp(c2)) from tba1 every(1s) +print execute sql select log(c2,interp(c2)) from stba every(1s) group by tbname; +sql_error select log(c2,interp(c2)) from stba every(1s) group by tbname; +print execute sql select log(c2,elapsed(ts)) from tba1; +sql_error select log(c2,elapsed(ts)) from tba1; +print execute sql select log(c2,rate(c2)) from tba1; +sql_error select log(c2,rate(c2)) from tba1; +print execute sql select log(c2,irate(c2)) from tba1; +sql_error select log(c2,irate(c2)) from tba1; +print execute sql select log(c2,first(c2)) from tba1; +sql_error select log(c2,first(c2)) from tba1; +print execute sql select log(c2,last(c2)) from tba1; +sql_error select log(c2,last(c2)) from tba1; +print execute sql select log(c2,last_row(c2)) from tba1; +sql_error select log(c2,last_row(c2)) from tba1; +print execute sql select log(c2,top(c2, 1)) from tba1; +sql_error select log(c2,top(c2, 1)) from tba1; +print execute sql select log(c2,bottom(c2, 1)) from tba1; +sql_error select log(c2,bottom(c2, 1)) from tba1; +print execute sql select log(c2,leastsquares(c2, 1, 1)) from tba1; +sql_error select log(c2,leastsquares(c2, 1, 1)) from tba1; +print execute sql select log(c2,derivative(c2, 1s, 0)) from tba1; +sql_error select log(c2,derivative(c2, 1s, 0)) from tba1; +print execute sql select log(c2,diff(c2)) from tba1; +sql_error select log(c2,diff(c2)) from tba1; +print execute sql select log(c2,csum(c2)) from tba1; +sql_error select log(c2,csum(c2)) from tba1; +print execute sql select log(c2,mavg(c2,2)) from tba1; +sql_error select log(c2,mavg(c2,2)) from tba1; +print execute sql select log(c2,sample(c2,2)) from tba1; +sql_error select log(c2,sample(c2,2)) from tba1; +print execute sql select log(c2,_block_dist()) from tba1; +sql_error select log(c2,_block_dist()) from tba1; diff --git a/tests/script/general/compute/math_pow.sim b/tests/script/general/compute/math_pow.sim new file mode 100644 index 0000000000..d3725e650b --- /dev/null +++ b/tests/script/general/compute/math_pow.sim @@ -0,0 +1,818 @@ +sleep 100 +sql connect +sql use db + +print execute sql select pow(c2,*) from tb1; +sql_error select pow(c2,*) from tb1; +print execute sql select pow(c2,*) from tb1; +sql_error select pow(c2,*) from tb1; +print execute sql select pow(c2,*) from tb1; +sql_error select pow(c2,*) from tb1; +print execute sql select pow(c2,*) from tb1; +sql_error select pow(c2,*) from tb1; +print execute sql select pow(c2,*) as a from tb1; +sql_error select pow(c2,*) as a from tb1; +print execute sql select pow(c2,*) + 1 as a from tb1; +sql_error select pow(c2,*) + 1 as a from tb1; +print execute sql select pow(c2,tb1.*) + 1 as a from tb1; +sql_error select pow(c2,tb1.*) + 1 as a from tb1; +print execute sql select pow(c2,*) from tb1; +sql_error select pow(c2,*) from tb1; +print execute sql select pow(c2,c1) from tb1; +sql_error select pow(c2,c1) from tb1; +print execute sql select pow(c2,c1) from tb1; +sql_error select pow(c2,c1) from tb1; +print execute sql select pow(c2,c1 + c2) from tb1; +sql_error select pow(c2,c1 + c2) from tb1; +print execute sql select pow(c2,13) from tb1; +sql select pow(c2,13) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @8192.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @67108864.000000000@ then + return -1 +endi +if $data50 != @2235879388560037013354446848.000000000@ then + return -1 +endi +if $data60 != @-2235879388560037013354446848.000000000@ then + return -1 +endi +print execute sql select pow(c2,c1) from tb1; +sql_error select pow(c2,c1) from tb1; +print execute sql select pow(c2,c2) from tb1; +sql select pow(c2,c2) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @1524307411995722675302034438441039929638133977529255166488930956750631981496706568536830801887788243768717590100078636207586147400582763177366354597171395424352865739982333218252608952069997640848048552956054564019622410252548018541775390307932677684494157475792027648.000000000@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c3) from tb1; +sql select pow(c2,c3) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c4) from tb1; +sql select pow(c2,c4) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c5) from tb1; +sql select pow(c2,c5) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c6) from tb1; +sql select pow(c2,c6) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c7) from tb1; +sql select pow(c2,c7) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c8) from tb1; +sql_error select pow(c2,c8) from tb1; +print execute sql select pow(c2,c9) from tb1; +sql_error select pow(c2,c9) from tb1; +print execute sql select pow(c2,c10) from tb1; +sql select pow(c2,c10) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,c11) from tb1; +sql select pow(c2,c11) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,c12) from tb1; +sql select pow(c2,c12) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,c13) from tb1; +sql select pow(c2,c13) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,12345678900000000000000000) from tb1; +sql_error select pow(c2,12345678900000000000000000) from tb1; +print execute sql select distinct pow(c2,123) from tb1; +sql_error select distinct pow(c2,123) from tb1; +print execute sql select pow(c2,t1) from stb1; +sql_error select pow(c2,t1) from stb1; +print execute sql select pow(c2,c1),avg(c3) from tb1; +sql_error select pow(c2,c1),avg(c3) from tb1; +print execute sql select pow(c2,c1),top(c3,1) from tb1; +sql_error select pow(c2,c1),top(c3,1) from tb1; +print execute sql select pow(c2,c2+c3) from tb1 session(ts, 1s); +sql_error select pow(c2,c2+c3) from tb1 session(ts, 1s); +print execute sql select pow(c2,c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select pow(c2,c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select pow(c2,c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select pow(c2,c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select pow(c2,c2+c3) from stb1 group by t1; +sql_error select pow(c2,c2+c3) from stb1 group by t1; +print execute sql select pow(c2,c2+c3) from stb1 group by ts; +sql_error select pow(c2,c2+c3) from stb1 group by ts; +print execute sql select pow(c2,c2+c3) from stb1 group by c1; +sql_error select pow(c2,c2+c3) from stb1 group by c1; +print execute sql select pow(c2,c2+c3) from stb1 group by tbname; +sql_error select pow(c2,c2+c3) from stb1 group by tbname; +print execute sql select pow(c2,c2+c3) from tb1 order by c2; +sql_error select pow(c2,c2+c3) from tb1 order by c2; +print execute sql select pow(c2,c8),pow(c2,c9) from tbn; +sql_error select pow(c2,c8),pow(c2,c9) from tbn; +print execute sql select pow(c2,ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select pow(c2,ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select pow(c2,a) from (select pow(c2,c2) as a from tb1); +sql_error select pow(c2,a) from (select pow(c2,c2) as a from tb1); +print execute sql select pow(c2,"abc") from tb1; +sql_error select pow(c2,"abc") from tb1; +print execute sql select pow(c2,c2 + c3) from tb1; +sql select pow(c2,c2 + c3) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @65536.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,(c2 + c3)) from tb1; +sql select pow(c2,(c2 + c3)) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @65536.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,(c2 * c3)+c4-6) from tb1; +sql select pow(c2,(c2 * c3)+c4-6) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @268435456.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,11)+c2 from tb1; +sql select pow(c2,11)+c2 from tb1; +if $data00 != @2.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @2050.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @4194308.000000000@ then + return -1 +endi +if $data50 != @138624799340320985710592.000000000@ then + return -1 +endi +if $data60 != @-138624799340320985710592.000000000@ then + return -1 +endi +print execute sql select pow(c2,c1)+c2 from tb1; +sql_error select pow(c2,c1)+c2 from tb1; +print execute sql select pow(c2,c2)+11 from tb1; +sql select pow(c2,c2)+11 from tb1; +if $data00 != @12.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @15.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @267.000000000@ then + return -1 +endi +if $data50 != @1524307411995722675302034438441039929638133977529255166488930956750631981496706568536830801887788243768717590100078636207586147400582763177366354597171395424352865739982333218252608952069997640848048552956054564019622410252548018541775390307932677684494157475792027648.000000000@ then + return -1 +endi +if $data60 != @11.000000000@ then + return -1 +endi +print execute sql select pow(c2,c1),c1,c2 from tb1; +sql_error select pow(c2,c1),c1,c2 from tb1; +print execute sql select pow(c2,c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select pow(c2,c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select pow(c2,c1),floor(c3) from tb1; +sql_error select pow(c2,c1),floor(c3) from tb1; +print execute sql select pow(c2,c1),pow(c2,c2+c3) from tb1; +sql_error select pow(c2,c1),pow(c2,c2+c3) from tb1; +print execute sql select pow(c2,c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select pow(c2,c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @65536.000000000@ then + return -1 +endi +if $data20 != @inf@ then + return -1 +endi +if $data30 != @0.000000000@ then + return -1 +endi +print execute sql select pow(c2,c2) from tb1 order by ts desc; +sql select pow(c2,c2) from tb1 order by ts desc; +if $data00 != @-0.000000000@ then + return -1 +endi +if $data10 != @1524307411995722675302034438441039929638133977529255166488930956750631981496706568536830801887788243768717590100078636207586147400582763177366354597171395424352865739982333218252608952069997640848048552956054564019622410252548018541775390307932677684494157475792027648.000000000@ then + return -1 +endi +if $data20 != @256.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @4.000000000@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,c2+c3) from tb1 order by ts desc; +sql select pow(c2,c2+c3) from tb1 order by ts desc; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @inf@ then + return -1 +endi +if $data20 != @65536.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @NULL@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select pow(c2,c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @65536.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select pow(c2,c2) from stb1; +sql select pow(c2,c2) from stb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @1524307411995722675302034438441039929638133977529255166488930956750631981496706568536830801887788243768717590100078636207586147400582763177366354597171395424352865739982333218252608952069997640848048552956054564019622410252548018541775390307932677684494157475792027648.000000000@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data80 != @4.000000000@ then + return -1 +endi +if $data90 != @27.000000000@ then + return -1 +endi +print execute sql select pow(c2,c2) from stb1 order by ts desc; +sql select pow(c2,c2) from stb1 order by ts desc; +if $data00 != @823543.000000000@ then + if $data00 != @-0.000000000@ then + return -1 + endi +endi +if $data20 != @46656.000000000@ then + if $data20 != @1524307411995722675302034438441039929638133977529255166488930956750631981496706568536830801887788243768717590100078636207586147400582763177366354597171395424352865739982333218252608952069997640848048552956054564019622410252548018541775390307932677684494157475792027648.000000000@ then + return -1 + endi +endi +if $data40 != @3125.000000000@ then + if $data40 != @256.000000000@ then + return -1 + endi +endi +if $data60 != @256.000000000@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @27.000000000@ then + if $data80 != @4.000000000@ then + return -1 + endi +endi +print execute sql select pow(c2,c4),t1 from stb1 order by ts desc; +sql select pow(c2,c4),t1 from stb1 order by ts desc; +if $data00 != @823543.000000000@ then + if $data00 != @-0.000000000@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @46656.000000000@ then + if $data20 != @inf@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @3125.000000000@ then + if $data40 != @256.000000000@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @256.000000000@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @9.000000000@ then + if $data80 != @4.000000000@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select pow(c2,c3),tbname from stb1; +sql select pow(c2,c3),tbname from stb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data01 != @tb1@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @tb1@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @tb1@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data51 != @tb1@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +if $data61 != @tb1@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @4.000000000@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @27.000000000@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select pow(c2,c3),tbname from stb1 where t1 > 1; +sql select pow(c2,c3),tbname from stb1 where t1 > 1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @4.000000000@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @27.000000000@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @256.000000000@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @3125.000000000@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @46656.000000000@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @823543.000000000@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select pow(c2,c8),pow(c2,c9) from tbn; +sql_error select pow(c2,c8),pow(c2,c9) from tbn; +print execute sql select pow(c2,c8),pow(c2,c9) from tbn order by ts desc; +sql_error select pow(c2,c8),pow(c2,c9) from tbn order by ts desc; +print execute sql select pow(c2,pow(c2,c8)) from tbn; +sql_error select pow(c2,pow(c2,c8)) from tbn; +print execute sql select pow(c2,a) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select pow(c2,a) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select pow(c2,c2) from (select * from stb1); +sql select pow(c2,c2) from (select * from stb1); +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @1524307411995722675302034438441039929638133977529255166488930956750631981496706568536830801887788243768717590100078636207586147400582763177366354597171395424352865739982333218252608952069997640848048552956054564019622410252548018541775390307932677684494157475792027648.000000000@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data80 != @4.000000000@ then + return -1 +endi +if $data90 != @27.000000000@ then + return -1 +endi +print execute sql select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)); +sql_error select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)); +print execute sql select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts; +sql_error select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts; +print execute sql select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts desc; +sql_error select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by ts desc; +print execute sql select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a desc; +sql_error select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a desc; +print execute sql select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a; +sql_error select pow(c2,a) from (select avg(c2) as a from stb1 where ts >= '2021-11-11 09:00:00.000' and ts <= '2021-11-11 09:00:09.000' interval(1s) fill(null)) order by a; +print execute sql select pow(c2,a) from (select pow(c2,c2) as a from tb1); +sql_error select pow(c2,a) from (select pow(c2,c2) as a from tb1); +print execute sql select pow(c2,tb1.c3),pow(c2,tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql_error select pow(c2,tb1.c3),pow(c2,tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +print execute sql select pow(c2,c3) from tb1 union all select pow(c2,c3) from tb2; +sql select pow(c2,c3) from tb1 union all select pow(c2,c3) from tb2; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data80 != @4.000000000@ then + return -1 +endi +if $data90 != @27.000000000@ then + return -1 +endi diff --git a/tests/script/general/compute/math_pow2.sim b/tests/script/general/compute/math_pow2.sim new file mode 100644 index 0000000000..416f989f12 --- /dev/null +++ b/tests/script/general/compute/math_pow2.sim @@ -0,0 +1,126 @@ +sleep 100 +sql connect +sql use db + +print execute sql select pow(c2,stb1.c4),pow(c2,stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql_error select pow(c2,stb1.c4),pow(c2,stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +print execute sql select pow(c2,c4) as a from stb1 union all select pow(c2,c5) as a from stba; +sql select pow(c2,c4) as a from stb1 union all select pow(c2,c5) as a from stba; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @4.000000000@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @256.000000000@ then + return -1 +endi +if $data50 != @inf@ then + return -1 +endi +if $data60 != @-0.000000000@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data80 != @4.000000000@ then + return -1 +endi +if $data90 != @9.000000000@ then + return -1 +endi +print execute sql select pow(c2,c2) from stba; +sql select pow(c2,c2) from stba; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @4.000000000@ then + return -1 +endi +if $data20 != @27.000000000@ then + return -1 +endi +if $data30 != @256.000000000@ then + return -1 +endi +if $data40 != @3125.000000000@ then + return -1 +endi +if $data50 != @46656.000000000@ then + return -1 +endi +if $data60 != @823543.000000000@ then + return -1 +endi +if $data70 != @16777216.000000000@ then + return -1 +endi +if $data80 != @387420489.000000000@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi +print execute sql select pow(c2,min(c2)) from tba1; +sql_error select pow(c2,min(c2)) from tba1; +print execute sql select pow(c2,max(c2)) from tba1; +sql_error select pow(c2,max(c2)) from tba1; +print execute sql select pow(c2,count(c2)) from tba1; +sql_error select pow(c2,count(c2)) from tba1; +print execute sql select pow(c2,sum(c2)) from tba1; +sql_error select pow(c2,sum(c2)) from tba1; +print execute sql select pow(c2,avg(c2)) from tba1; +sql_error select pow(c2,avg(c2)) from tba1; +print execute sql select pow(c2,percentile(c2, 10)) from tba1; +sql_error select pow(c2,percentile(c2, 10)) from tba1; +print execute sql select pow(c2,apercentile(c2, 10)) from tba1; +sql_error select pow(c2,apercentile(c2, 10)) from tba1; +print execute sql select pow(c2,stddev(c2)) from tba1; +sql_error select pow(c2,stddev(c2)) from tba1; +print execute sql select pow(c2,spread(c2)) from tba1; +sql_error select pow(c2,spread(c2)) from tba1; +print execute sql select pow(c2,twa(c2)) from tba1; +sql_error select pow(c2,twa(c2)) from tba1; +print execute sql select pow(c2,leastsquares(c2, 1, 1)) from tba1; +sql_error select pow(c2,leastsquares(c2, 1, 1)) from tba1; +print execute sql select pow(c2,interp(c2)) from tba1 every(1s) +sql_error select pow(c2,interp(c2)) from tba1 every(1s) +print execute sql select pow(c2,interp(c2)) from stba every(1s) group by tbname; +sql_error select pow(c2,interp(c2)) from stba every(1s) group by tbname; +print execute sql select pow(c2,elapsed(ts)) from tba1; +sql_error select pow(c2,elapsed(ts)) from tba1; +print execute sql select pow(c2,rate(c2)) from tba1; +sql_error select pow(c2,rate(c2)) from tba1; +print execute sql select pow(c2,irate(c2)) from tba1; +sql_error select pow(c2,irate(c2)) from tba1; +print execute sql select pow(c2,first(c2)) from tba1; +sql_error select pow(c2,first(c2)) from tba1; +print execute sql select pow(c2,last(c2)) from tba1; +sql_error select pow(c2,last(c2)) from tba1; +print execute sql select pow(c2,last_row(c2)) from tba1; +sql_error select pow(c2,last_row(c2)) from tba1; +print execute sql select pow(c2,top(c2, 1)) from tba1; +sql_error select pow(c2,top(c2, 1)) from tba1; +print execute sql select pow(c2,bottom(c2, 1)) from tba1; +sql_error select pow(c2,bottom(c2, 1)) from tba1; +print execute sql select pow(c2,leastsquares(c2, 1, 1)) from tba1; +sql_error select pow(c2,leastsquares(c2, 1, 1)) from tba1; +print execute sql select pow(c2,derivative(c2, 1s, 0)) from tba1; +sql_error select pow(c2,derivative(c2, 1s, 0)) from tba1; +print execute sql select pow(c2,diff(c2)) from tba1; +sql_error select pow(c2,diff(c2)) from tba1; +print execute sql select pow(c2,csum(c2)) from tba1; +sql_error select pow(c2,csum(c2)) from tba1; +print execute sql select pow(c2,mavg(c2,2)) from tba1; +sql_error select pow(c2,mavg(c2,2)) from tba1; +print execute sql select pow(c2,sample(c2,2)) from tba1; +sql_error select pow(c2,sample(c2,2)) from tba1; +print execute sql select pow(c2,_block_dist()) from tba1; +sql_error select pow(c2,_block_dist()) from tba1; -- GitLab