From ba878b03c20319f32ba387cdcafc0d904c3b9a71 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Wed, 8 Dec 2021 16:07:27 +0800 Subject: [PATCH] add triangle test case --- tests/script/general/compute/math_acos.sim | 1073 +++++++++++++++++ tests/script/general/compute/math_acos2.sim | 366 ++++++ tests/script/general/compute/math_atan.sim | 1073 +++++++++++++++++ tests/script/general/compute/math_atan2.sim | 366 ++++++ tests/script/general/compute/math_cos.sim | 1073 +++++++++++++++++ tests/script/general/compute/math_cos2.sim | 366 ++++++ tests/script/general/compute/math_sin.sim | 1073 +++++++++++++++++ tests/script/general/compute/math_sin2.sim | 366 ++++++ .../script/general/compute/math_str_func.sim | 15 + tests/script/general/compute/math_tan.sim | 1073 +++++++++++++++++ tests/script/general/compute/math_tan2.sim | 366 ++++++ 11 files changed, 7210 insertions(+) create mode 100644 tests/script/general/compute/math_acos.sim create mode 100644 tests/script/general/compute/math_acos2.sim create mode 100644 tests/script/general/compute/math_atan.sim create mode 100644 tests/script/general/compute/math_atan2.sim create mode 100644 tests/script/general/compute/math_cos.sim create mode 100644 tests/script/general/compute/math_cos2.sim create mode 100644 tests/script/general/compute/math_sin.sim create mode 100644 tests/script/general/compute/math_sin2.sim create mode 100644 tests/script/general/compute/math_tan.sim create mode 100644 tests/script/general/compute/math_tan2.sim diff --git a/tests/script/general/compute/math_acos.sim b/tests/script/general/compute/math_acos.sim new file mode 100644 index 0000000000..b91af7e647 --- /dev/null +++ b/tests/script/general/compute/math_acos.sim @@ -0,0 +1,1073 @@ +sleep 100 +sql connect +sql use db + +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) as a from tb1; +sql_error select acos(*) as a from tb1; +print execute sql select acos(*) + 1 as a from tb1; +sql_error select acos(*) + 1 as a from tb1; +print execute sql select acos(tb1.*) + 1 as a from tb1; +sql_error select acos(tb1.*) + 1 as a from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(c1) from tb1; +sql_error select acos(c1) from tb1; +print execute sql select acos(c1) from tb1; +sql_error select acos(c1) from tb1; +print execute sql select acos(c1 + c2) from tb1; +sql_error select acos(c1 + c2) from tb1; +print execute sql select acos(13) from tb1; +sql select acos(13) from tb1; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c1) from tb1; +sql_error select acos(c1) from tb1; +print execute sql select acos(c2) from tb1; +sql select acos(c2) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c3) from tb1; +sql select acos(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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c4) from tb1; +sql select acos(c4) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c5) from tb1; +sql select acos(c5) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c6) from tb1; +sql select acos(c6) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c7) from tb1; +sql select acos(c7) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c8) from tb1; +sql_error select acos(c8) from tb1; +print execute sql select acos(c9) from tb1; +sql_error select acos(c9) from tb1; +print execute sql select acos(c10) from tb1; +sql select acos(c10) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(c11) from tb1; +sql select acos(c11) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(c12) from tb1; +sql select acos(c12) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(c13) from tb1; +sql select acos(c13) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(12345678900000000000000000) from tb1; +sql_error select acos(12345678900000000000000000) from tb1; +print execute sql select distinct acos(123) from tb1; +sql_error select distinct acos(123) from tb1; +print execute sql select acos(t1) from stb1; +sql_error select acos(t1) from stb1; +print execute sql select acos(c1),avg(c3) from tb1; +sql_error select acos(c1),avg(c3) from tb1; +print execute sql select acos(c1),top(c3,1) from tb1; +sql_error select acos(c1),top(c3,1) from tb1; +print execute sql select acos(c2+c3) from tb1 session(ts, 1s); +sql_error select acos(c2+c3) from tb1 session(ts, 1s); +print execute sql select acos(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select acos(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select acos(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select acos(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select acos(c2+c3) from stb1 group by t1; +sql_error select acos(c2+c3) from stb1 group by t1; +print execute sql select acos(c2+c3) from stb1 group by ts; +sql_error select acos(c2+c3) from stb1 group by ts; +print execute sql select acos(c2+c3) from stb1 group by c1; +sql_error select acos(c2+c3) from stb1 group by c1; +print execute sql select acos(c2+c3) from stb1 group by tbname; +sql_error select acos(c2+c3) from stb1 group by tbname; +print execute sql select acos(c2+c3) from tb1 order by c2; +sql_error select acos(c2+c3) from tb1 order by c2; +print execute sql select acos(c8),acos(c9) from tbn; +sql_error select acos(c8),acos(c9) from tbn; +print execute sql select acos(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select acos(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select acos(a) from (select acos(c2) as a from tb1); +sql select acos(a) from (select acos(c2) as a from tb1); +if $data00 != @1.570796327@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos("abc") from tb1; +sql_error select acos("abc") from tb1; +print execute sql select acos(c2 + c3) from tb1; +sql select acos(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 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos((c2 + c3)) from tb1; +sql select acos((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 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos((c2 * c3)+c4-6) from tb1; +sql select acos((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 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(11)+c2 from tb1; +sql select acos(11)+c2 from tb1; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c1)+c2 from tb1; +sql_error select acos(c1)+c2 from tb1; +print execute sql select acos(c2)+11 from tb1; +sql select acos(c2)+11 from tb1; +if $data00 != @11.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c1),c1,c2 from tb1; +sql_error select acos(c1),c1,c2 from tb1; +print execute sql select acos(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select acos(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select acos(c1),floor(c3) from tb1; +sql_error select acos(c1),floor(c3) from tb1; +print execute sql select acos(c1),acos(c2+c3) from tb1; +sql_error select acos(c1),acos(c2+c3) from tb1; +print execute sql select acos(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select acos(c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from tb1 order by ts desc; +sql select acos(c2) from tb1 order by ts desc; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select acos(c2+c3) from tb1 order by ts desc; +sql select acos(c2+c3) from tb1 order by ts desc; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ 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 != @nan@ then + return -1 +endi +print execute sql select acos(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select acos(c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select acos(c2) from stb1; +sql select acos(c2) from stb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from stb1 order by ts desc; +sql select acos(c2) from stb1 order by ts desc; +if $data00 != @nan@ then + if $data00 != @nan@ then + return -1 + endi +endi +if $data20 != @nan@ then + if $data20 != @nan@ then + return -1 + endi +endi +if $data40 != @nan@ then + if $data40 != @nan@ then + return -1 + endi +endi +if $data60 != @nan@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @nan@ then + if $data80 != @nan@ then + return -1 + endi +endi +print execute sql select acos(c4),t1 from stb1 order by ts desc; +sql select acos(c4),t1 from stb1 order by ts desc; +if $data00 != @nan@ then + if $data00 != @nan@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @nan@ then + if $data20 != @nan@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @nan@ then + if $data40 != @nan@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @nan@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @nan@ then + if $data80 != @nan@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select acos(c3),tbname from stb1; +sql select acos(c3),tbname from stb1; +if $data00 != @0.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 != @nan@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @nan@ 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 != @0.000000000@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select acos(c3),tbname from stb1 where t1 > 1; +sql select acos(c3),tbname from stb1 where t1 > 1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select acos(c8),acos(c9) from tbn; +sql_error select acos(c8),acos(c9) from tbn; +print execute sql select acos(c8),acos(c9) from tbn order by ts desc; +sql_error select acos(c8),acos(c9) from tbn order by ts desc; +print execute sql select acos(acos(c8)) from tbn; +sql_error select acos(acos(c8)) from tbn; +print execute sql select acos(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select acos(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from (select * from stb1); +sql select acos(c2) from (select * from stb1); +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(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 select acos(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)); +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @nan@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @0.000000000@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @nan@ then + return -1 +endi +if $data80 != @0.000000000@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @0.000000000@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select acos(a) from (select acos(c2) as a from tb1); +sql select acos(a) from (select acos(c2) as a from tb1); +if $data00 != @1.570796327@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(tb1.c3),acos(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select acos(tb1.c3),acos(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @0.000000000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +print execute sql select acos(c3) from tb1 union all select acos(c3) from tb2; +sql select acos(c3) from tb1 union all select acos(c3) from tb2; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi diff --git a/tests/script/general/compute/math_acos2.sim b/tests/script/general/compute/math_acos2.sim new file mode 100644 index 0000000000..01a83eb4d4 --- /dev/null +++ b/tests/script/general/compute/math_acos2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select acos(stb1.c4),acos(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select acos(stb1.c4),acos(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @0.000000000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +print execute sql select acos(c4) as a from stb1 union all select acos(c5) as a from stba; +sql select acos(c4) as a from stb1 union all select acos(c5) as a from stba; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from stba; +sql select acos(c2) from stba; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @nan@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @1.570796327@ then + return -1 +endi +print execute sql select acos(min(c2)) from tba1; +sql select acos(min(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(max(c2)) from tba1; +sql select acos(max(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(count(c2)) from tba1; +sql select acos(count(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(sum(c2)) from tba1; +sql select acos(sum(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(avg(c2)) from tba1; +sql select acos(avg(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(percentile(c2, 10)) from tba1; +sql select acos(percentile(c2, 10)) from tba1; +if $data00 != @0.451026812@ then + return -1 +endi +print execute sql select acos(apercentile(c2, 10)) from tba1; +sql select acos(apercentile(c2, 10)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(stddev(c2)) from tba1; +sql select acos(stddev(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(spread(c2)) from tba1; +sql select acos(spread(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(twa(c2)) from tba1; +sql select acos(twa(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(leastsquares(c2, 1, 1)) from tba1; +sql_error select acos(leastsquares(c2, 1, 1)) from tba1; +print execute sql select acos(interp(c2)) from tba1 every(1s) +sql select acos(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @nan@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @nan@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @1.570796327@ then + return -1 +endi +print execute sql select acos(interp(c2)) from stba every(1s) group by tbname; +sql select acos(interp(c2)) from stba every(1s) group by tbname; +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data02 != @tba1@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data12 != @tba1@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data22 != @tba1@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data32 != @tba1@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data42 != @tba1@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data52 != @tba1@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +if $data62 != @tba1@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @nan@ then + return -1 +endi +if $data72 != @tba1@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @nan@ then + return -1 +endi +if $data82 != @tba1@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @1.570796327@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select acos(elapsed(ts)) from tba1; +sql select acos(elapsed(ts)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(rate(c2)) from tba1; +sql select acos(rate(c2)) from tba1; +if $data00 != @0.458874205@ then + return -1 +endi +print execute sql select acos(irate(c2)) from tba1; +sql select acos(irate(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(first(c2)) from tba1; +sql select acos(first(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select acos(last(c2)) from tba1; +sql select acos(last(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(last_row(c2)) from tba1; +sql select acos(last_row(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(top(c2, 1)) from tba1; +sql_error select acos(top(c2, 1)) from tba1; +print execute sql select acos(bottom(c2, 1)) from tba1; +sql_error select acos(bottom(c2, 1)) from tba1; +print execute sql select acos(leastsquares(c2, 1, 1)) from tba1; +sql_error select acos(leastsquares(c2, 1, 1)) from tba1; +print execute sql select acos(derivative(c2, 1s, 0)) from tba1; +sql_error select acos(derivative(c2, 1s, 0)) from tba1; +print execute sql select acos(diff(c2)) from tba1; +sql_error select acos(diff(c2)) from tba1; +print execute sql select acos(csum(c2)) from tba1; +sql_error select acos(csum(c2)) from tba1; +print execute sql select acos(mavg(c2,2)) from tba1; +sql_error select acos(mavg(c2,2)) from tba1; +print execute sql select acos(sample(c2,2)) from tba1; +sql_error select acos(sample(c2,2)) from tba1; +print execute sql select acos(_block_dist()) from tba1; +sql_error select acos(_block_dist()) from tba1; diff --git a/tests/script/general/compute/math_atan.sim b/tests/script/general/compute/math_atan.sim new file mode 100644 index 0000000000..b91af7e647 --- /dev/null +++ b/tests/script/general/compute/math_atan.sim @@ -0,0 +1,1073 @@ +sleep 100 +sql connect +sql use db + +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(*) as a from tb1; +sql_error select acos(*) as a from tb1; +print execute sql select acos(*) + 1 as a from tb1; +sql_error select acos(*) + 1 as a from tb1; +print execute sql select acos(tb1.*) + 1 as a from tb1; +sql_error select acos(tb1.*) + 1 as a from tb1; +print execute sql select acos(*) from tb1; +sql_error select acos(*) from tb1; +print execute sql select acos(c1) from tb1; +sql_error select acos(c1) from tb1; +print execute sql select acos(c1) from tb1; +sql_error select acos(c1) from tb1; +print execute sql select acos(c1 + c2) from tb1; +sql_error select acos(c1 + c2) from tb1; +print execute sql select acos(13) from tb1; +sql select acos(13) from tb1; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c1) from tb1; +sql_error select acos(c1) from tb1; +print execute sql select acos(c2) from tb1; +sql select acos(c2) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c3) from tb1; +sql select acos(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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c4) from tb1; +sql select acos(c4) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c5) from tb1; +sql select acos(c5) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c6) from tb1; +sql select acos(c6) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c7) from tb1; +sql select acos(c7) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c8) from tb1; +sql_error select acos(c8) from tb1; +print execute sql select acos(c9) from tb1; +sql_error select acos(c9) from tb1; +print execute sql select acos(c10) from tb1; +sql select acos(c10) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(c11) from tb1; +sql select acos(c11) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(c12) from tb1; +sql select acos(c12) from tb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(c13) from tb1; +sql select acos(c13) 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 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @1.570796327@ then + return -1 +endi +print execute sql select acos(12345678900000000000000000) from tb1; +sql_error select acos(12345678900000000000000000) from tb1; +print execute sql select distinct acos(123) from tb1; +sql_error select distinct acos(123) from tb1; +print execute sql select acos(t1) from stb1; +sql_error select acos(t1) from stb1; +print execute sql select acos(c1),avg(c3) from tb1; +sql_error select acos(c1),avg(c3) from tb1; +print execute sql select acos(c1),top(c3,1) from tb1; +sql_error select acos(c1),top(c3,1) from tb1; +print execute sql select acos(c2+c3) from tb1 session(ts, 1s); +sql_error select acos(c2+c3) from tb1 session(ts, 1s); +print execute sql select acos(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select acos(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select acos(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select acos(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select acos(c2+c3) from stb1 group by t1; +sql_error select acos(c2+c3) from stb1 group by t1; +print execute sql select acos(c2+c3) from stb1 group by ts; +sql_error select acos(c2+c3) from stb1 group by ts; +print execute sql select acos(c2+c3) from stb1 group by c1; +sql_error select acos(c2+c3) from stb1 group by c1; +print execute sql select acos(c2+c3) from stb1 group by tbname; +sql_error select acos(c2+c3) from stb1 group by tbname; +print execute sql select acos(c2+c3) from tb1 order by c2; +sql_error select acos(c2+c3) from tb1 order by c2; +print execute sql select acos(c8),acos(c9) from tbn; +sql_error select acos(c8),acos(c9) from tbn; +print execute sql select acos(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select acos(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select acos(a) from (select acos(c2) as a from tb1); +sql select acos(a) from (select acos(c2) as a from tb1); +if $data00 != @1.570796327@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos("abc") from tb1; +sql_error select acos("abc") from tb1; +print execute sql select acos(c2 + c3) from tb1; +sql select acos(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 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos((c2 + c3)) from tb1; +sql select acos((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 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos((c2 * c3)+c4-6) from tb1; +sql select acos((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 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(11)+c2 from tb1; +sql select acos(11)+c2 from tb1; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c1)+c2 from tb1; +sql_error select acos(c1)+c2 from tb1; +print execute sql select acos(c2)+11 from tb1; +sql select acos(c2)+11 from tb1; +if $data00 != @11.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c1),c1,c2 from tb1; +sql_error select acos(c1),c1,c2 from tb1; +print execute sql select acos(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select acos(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select acos(c1),floor(c3) from tb1; +sql_error select acos(c1),floor(c3) from tb1; +print execute sql select acos(c1),acos(c2+c3) from tb1; +sql_error select acos(c1),acos(c2+c3) from tb1; +print execute sql select acos(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select acos(c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from tb1 order by ts desc; +sql select acos(c2) from tb1 order by ts desc; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select acos(c2+c3) from tb1 order by ts desc; +sql select acos(c2+c3) from tb1 order by ts desc; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ 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 != @nan@ then + return -1 +endi +print execute sql select acos(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select acos(c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select acos(c2) from stb1; +sql select acos(c2) from stb1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from stb1 order by ts desc; +sql select acos(c2) from stb1 order by ts desc; +if $data00 != @nan@ then + if $data00 != @nan@ then + return -1 + endi +endi +if $data20 != @nan@ then + if $data20 != @nan@ then + return -1 + endi +endi +if $data40 != @nan@ then + if $data40 != @nan@ then + return -1 + endi +endi +if $data60 != @nan@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @nan@ then + if $data80 != @nan@ then + return -1 + endi +endi +print execute sql select acos(c4),t1 from stb1 order by ts desc; +sql select acos(c4),t1 from stb1 order by ts desc; +if $data00 != @nan@ then + if $data00 != @nan@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @nan@ then + if $data20 != @nan@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @nan@ then + if $data40 != @nan@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @nan@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @nan@ then + if $data80 != @nan@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select acos(c3),tbname from stb1; +sql select acos(c3),tbname from stb1; +if $data00 != @0.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 != @nan@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @nan@ 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 != @0.000000000@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select acos(c3),tbname from stb1 where t1 > 1; +sql select acos(c3),tbname from stb1 where t1 > 1; +if $data00 != @0.000000000@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select acos(c8),acos(c9) from tbn; +sql_error select acos(c8),acos(c9) from tbn; +print execute sql select acos(c8),acos(c9) from tbn order by ts desc; +sql_error select acos(c8),acos(c9) from tbn order by ts desc; +print execute sql select acos(acos(c8)) from tbn; +sql_error select acos(acos(c8)) from tbn; +print execute sql select acos(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select acos(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from (select * from stb1); +sql select acos(c2) from (select * from stb1); +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(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 select acos(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)); +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @nan@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @0.000000000@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @nan@ then + return -1 +endi +if $data80 != @0.000000000@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(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 select acos(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; +if $data00 != @nan@ then + return -1 +endi +if $data10 != @0.000000000@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select acos(a) from (select acos(c2) as a from tb1); +sql select acos(a) from (select acos(c2) as a from tb1); +if $data00 != @1.570796327@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +print execute sql select acos(tb1.c3),acos(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select acos(tb1.c3),acos(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @0.000000000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +print execute sql select acos(c3) from tb1 union all select acos(c3) from tb2; +sql select acos(c3) from tb1 union all select acos(c3) from tb2; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi diff --git a/tests/script/general/compute/math_atan2.sim b/tests/script/general/compute/math_atan2.sim new file mode 100644 index 0000000000..01a83eb4d4 --- /dev/null +++ b/tests/script/general/compute/math_atan2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select acos(stb1.c4),acos(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select acos(stb1.c4),acos(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @0.000000000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +print execute sql select acos(c4) as a from stb1 union all select acos(c5) as a from stba; +sql select acos(c4) as a from stb1 union all select acos(c5) as a from stba; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @0.000000000@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select acos(c2) from stba; +sql select acos(c2) from stba; +if $data00 != @0.000000000@ then + return -1 +endi +if $data10 != @nan@ then + return -1 +endi +if $data20 != @nan@ then + return -1 +endi +if $data30 != @nan@ then + return -1 +endi +if $data40 != @nan@ then + return -1 +endi +if $data50 != @nan@ then + return -1 +endi +if $data60 != @nan@ then + return -1 +endi +if $data70 != @nan@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @1.570796327@ then + return -1 +endi +print execute sql select acos(min(c2)) from tba1; +sql select acos(min(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(max(c2)) from tba1; +sql select acos(max(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(count(c2)) from tba1; +sql select acos(count(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(sum(c2)) from tba1; +sql select acos(sum(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(avg(c2)) from tba1; +sql select acos(avg(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(percentile(c2, 10)) from tba1; +sql select acos(percentile(c2, 10)) from tba1; +if $data00 != @0.451026812@ then + return -1 +endi +print execute sql select acos(apercentile(c2, 10)) from tba1; +sql select acos(apercentile(c2, 10)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(stddev(c2)) from tba1; +sql select acos(stddev(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(spread(c2)) from tba1; +sql select acos(spread(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(twa(c2)) from tba1; +sql select acos(twa(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(leastsquares(c2, 1, 1)) from tba1; +sql_error select acos(leastsquares(c2, 1, 1)) from tba1; +print execute sql select acos(interp(c2)) from tba1 every(1s) +sql select acos(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @nan@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @nan@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @1.570796327@ then + return -1 +endi +print execute sql select acos(interp(c2)) from stba every(1s) group by tbname; +sql select acos(interp(c2)) from stba every(1s) group by tbname; +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.000000000@ then + return -1 +endi +if $data02 != @tba1@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @nan@ then + return -1 +endi +if $data12 != @tba1@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @nan@ then + return -1 +endi +if $data22 != @tba1@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @nan@ then + return -1 +endi +if $data32 != @tba1@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @nan@ then + return -1 +endi +if $data42 != @tba1@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @nan@ then + return -1 +endi +if $data52 != @tba1@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @nan@ then + return -1 +endi +if $data62 != @tba1@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @nan@ then + return -1 +endi +if $data72 != @tba1@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @nan@ then + return -1 +endi +if $data82 != @tba1@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @1.570796327@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select acos(elapsed(ts)) from tba1; +sql select acos(elapsed(ts)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select acos(rate(c2)) from tba1; +sql select acos(rate(c2)) from tba1; +if $data00 != @0.458874205@ then + return -1 +endi +print execute sql select acos(irate(c2)) from tba1; +sql select acos(irate(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(first(c2)) from tba1; +sql select acos(first(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select acos(last(c2)) from tba1; +sql select acos(last(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(last_row(c2)) from tba1; +sql select acos(last_row(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select acos(top(c2, 1)) from tba1; +sql_error select acos(top(c2, 1)) from tba1; +print execute sql select acos(bottom(c2, 1)) from tba1; +sql_error select acos(bottom(c2, 1)) from tba1; +print execute sql select acos(leastsquares(c2, 1, 1)) from tba1; +sql_error select acos(leastsquares(c2, 1, 1)) from tba1; +print execute sql select acos(derivative(c2, 1s, 0)) from tba1; +sql_error select acos(derivative(c2, 1s, 0)) from tba1; +print execute sql select acos(diff(c2)) from tba1; +sql_error select acos(diff(c2)) from tba1; +print execute sql select acos(csum(c2)) from tba1; +sql_error select acos(csum(c2)) from tba1; +print execute sql select acos(mavg(c2,2)) from tba1; +sql_error select acos(mavg(c2,2)) from tba1; +print execute sql select acos(sample(c2,2)) from tba1; +sql_error select acos(sample(c2,2)) from tba1; +print execute sql select acos(_block_dist()) from tba1; +sql_error select acos(_block_dist()) from tba1; diff --git a/tests/script/general/compute/math_cos.sim b/tests/script/general/compute/math_cos.sim new file mode 100644 index 0000000000..b10845ce2e --- /dev/null +++ b/tests/script/general/compute/math_cos.sim @@ -0,0 +1,1073 @@ +sleep 100 +sql connect +sql use db + +print execute sql select cos(*) from tb1; +sql_error select cos(*) from tb1; +print execute sql select cos(*) from tb1; +sql_error select cos(*) from tb1; +print execute sql select cos(*) from tb1; +sql_error select cos(*) from tb1; +print execute sql select cos(*) from tb1; +sql_error select cos(*) from tb1; +print execute sql select cos(*) as a from tb1; +sql_error select cos(*) as a from tb1; +print execute sql select cos(*) + 1 as a from tb1; +sql_error select cos(*) + 1 as a from tb1; +print execute sql select cos(tb1.*) + 1 as a from tb1; +sql_error select cos(tb1.*) + 1 as a from tb1; +print execute sql select cos(*) from tb1; +sql_error select cos(*) from tb1; +print execute sql select cos(c1) from tb1; +sql_error select cos(c1) from tb1; +print execute sql select cos(c1) from tb1; +sql_error select cos(c1) from tb1; +print execute sql select cos(c1 + c2) from tb1; +sql_error select cos(c1 + c2) from tb1; +print execute sql select cos(13) from tb1; +sql select cos(13) from tb1; +if $data00 != @0.907446781@ then + return -1 +endi +if $data10 != @0.907446781@ then + return -1 +endi +if $data20 != @0.907446781@ then + return -1 +endi +if $data30 != @0.907446781@ then + return -1 +endi +if $data40 != @0.907446781@ then + return -1 +endi +if $data50 != @0.907446781@ then + return -1 +endi +if $data60 != @0.907446781@ then + return -1 +endi +print execute sql select cos(c1) from tb1; +sql_error select cos(c1) from tb1; +print execute sql select cos(c2) from tb1; +sql select cos(c2) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.232359102@ then + return -1 +endi +if $data60 != @0.232359102@ then + return -1 +endi +print execute sql select cos(c3) from tb1; +sql select cos(c3) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.982263352@ then + return -1 +endi +if $data60 != @0.982263352@ then + return -1 +endi +print execute sql select cos(c4) from tb1; +sql select cos(c4) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @-0.688836692@ then + return -1 +endi +if $data60 != @-0.688836692@ then + return -1 +endi +print execute sql select cos(c5) from tb1; +sql select cos(c5) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.011800077@ then + return -1 +endi +if $data60 != @0.011800077@ then + return -1 +endi +print execute sql select cos(c6) from tb1; +sql select cos(c6) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.853021040@ then + return -1 +endi +if $data60 != @0.853021040@ then + return -1 +endi +print execute sql select cos(c7) from tb1; +sql select cos(c7) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.488025633@ then + return -1 +endi +if $data60 != @0.488025633@ then + return -1 +endi +print execute sql select cos(c8) from tb1; +sql_error select cos(c8) from tb1; +print execute sql select cos(c9) from tb1; +sql_error select cos(c9) from tb1; +print execute sql select cos(c10) from tb1; +sql select cos(c10) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @-0.892018495@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select cos(c11) from tb1; +sql select cos(c11) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.929682584@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select cos(c12) from tb1; +sql select cos(c12) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @-0.051008024@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select cos(c13) from tb1; +sql select cos(c13) from tb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.011800077@ then + return -1 +endi +if $data60 != @1.000000000@ then + return -1 +endi +print execute sql select cos(12345678900000000000000000) from tb1; +sql_error select cos(12345678900000000000000000) from tb1; +print execute sql select distinct cos(123) from tb1; +sql_error select distinct cos(123) from tb1; +print execute sql select cos(t1) from stb1; +sql_error select cos(t1) from stb1; +print execute sql select cos(c1),avg(c3) from tb1; +sql_error select cos(c1),avg(c3) from tb1; +print execute sql select cos(c1),top(c3,1) from tb1; +sql_error select cos(c1),top(c3,1) from tb1; +print execute sql select cos(c2+c3) from tb1 session(ts, 1s); +sql_error select cos(c2+c3) from tb1 session(ts, 1s); +print execute sql select cos(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select cos(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select cos(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select cos(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select cos(c2+c3) from stb1 group by t1; +sql_error select cos(c2+c3) from stb1 group by t1; +print execute sql select cos(c2+c3) from stb1 group by ts; +sql_error select cos(c2+c3) from stb1 group by ts; +print execute sql select cos(c2+c3) from stb1 group by c1; +sql_error select cos(c2+c3) from stb1 group by c1; +print execute sql select cos(c2+c3) from stb1 group by tbname; +sql_error select cos(c2+c3) from stb1 group by tbname; +print execute sql select cos(c2+c3) from tb1 order by c2; +sql_error select cos(c2+c3) from tb1 order by c2; +print execute sql select cos(c8),cos(c9) from tbn; +sql_error select cos(c8),cos(c9) from tbn; +print execute sql select cos(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select cos(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select cos(a) from (select cos(c2) as a from tb1); +sql select cos(a) from (select cos(c2) as a from tb1); +if $data00 != @0.857553216@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.914653326@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.793873449@ then + return -1 +endi +if $data50 != @0.973125864@ then + return -1 +endi +if $data60 != @0.973125864@ then + return -1 +endi +print execute sql select cos("abc") from tb1; +sql_error select cos("abc") from tb1; +print execute sql select cos(c2 + c3) from tb1; +sql select cos(c2 + c3) from tb1; +if $data00 != @-0.416146837@ 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.145500034@ then + return -1 +endi +if $data50 != @0.045863318@ then + return -1 +endi +if $data60 != @0.045863318@ then + return -1 +endi +print execute sql select cos((c2 + c3)) from tb1; +sql select cos((c2 + c3)) from tb1; +if $data00 != @-0.416146837@ 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.145500034@ then + return -1 +endi +if $data50 != @0.045863318@ then + return -1 +endi +if $data60 != @0.045863318@ then + return -1 +endi +print execute sql select cos((c2 * c3)+c4-6) from tb1; +sql select cos((c2 * c3)+c4-6) from tb1; +if $data00 != @-0.653643621@ 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.136737218@ then + return -1 +endi +if $data50 != @-0.996514711@ then + return -1 +endi +if $data60 != @0.134138861@ then + return -1 +endi +print execute sql select cos(11)+c2 from tb1; +sql select cos(11)+c2 from tb1; +if $data00 != @1.004425698@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @2.004425698@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @4.004425698@ then + return -1 +endi +if $data50 != @127.004425698@ then + return -1 +endi +if $data60 != @-126.995574302@ then + return -1 +endi +print execute sql select cos(c1)+c2 from tb1; +sql_error select cos(c1)+c2 from tb1; +print execute sql select cos(c2)+11 from tb1; +sql select cos(c2)+11 from tb1; +if $data00 != @11.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @10.583853163@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @10.346356379@ then + return -1 +endi +if $data50 != @11.232359102@ then + return -1 +endi +if $data60 != @11.232359102@ then + return -1 +endi +print execute sql select cos(c1),c1,c2 from tb1; +sql_error select cos(c1),c1,c2 from tb1; +print execute sql select cos(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select cos(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select cos(c1),floor(c3) from tb1; +sql_error select cos(c1),floor(c3) from tb1; +print execute sql select cos(c1),cos(c2+c3) from tb1; +sql_error select cos(c1),cos(c2+c3) from tb1; +print execute sql select cos(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select cos(c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @-0.416146837@ then + return -1 +endi +if $data10 != @-0.145500034@ then + return -1 +endi +if $data20 != @0.045863318@ then + return -1 +endi +if $data30 != @0.045863318@ then + return -1 +endi +print execute sql select cos(c2) from tb1 order by ts desc; +sql select cos(c2) from tb1 order by ts desc; +if $data00 != @0.232359102@ then + return -1 +endi +if $data10 != @0.232359102@ then + return -1 +endi +if $data20 != @-0.653643621@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.416146837@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @0.540302306@ then + return -1 +endi +print execute sql select cos(c2+c3) from tb1 order by ts desc; +sql select cos(c2+c3) from tb1 order by ts desc; +if $data00 != @0.045863318@ then + return -1 +endi +if $data10 != @0.045863318@ then + return -1 +endi +if $data20 != @-0.145500034@ 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.416146837@ then + return -1 +endi +print execute sql select cos(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select cos(c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @-0.145500034@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select cos(c2) from stb1; +sql select cos(c2) from stb1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.232359102@ then + return -1 +endi +if $data60 != @0.232359102@ then + return -1 +endi +if $data70 != @0.540302306@ then + return -1 +endi +if $data80 != @-0.416146837@ then + return -1 +endi +if $data90 != @-0.989992497@ then + return -1 +endi +print execute sql select cos(c2) from stb1 order by ts desc; +sql select cos(c2) from stb1 order by ts desc; +if $data00 != @0.753902254@ then + if $data00 != @0.232359102@ then + return -1 + endi +endi +if $data20 != @0.960170287@ then + if $data20 != @0.232359102@ then + return -1 + endi +endi +if $data40 != @0.283662185@ then + if $data40 != @-0.653643621@ then + return -1 + endi +endi +if $data60 != @-0.653643621@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @-0.989992497@ then + if $data80 != @-0.416146837@ then + return -1 + endi +endi +print execute sql select cos(c4),t1 from stb1 order by ts desc; +sql select cos(c4),t1 from stb1 order by ts desc; +if $data00 != @0.753902254@ then + if $data00 != @-0.688836692@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @0.960170287@ then + if $data20 != @-0.688836692@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @0.283662185@ then + if $data40 != @-0.653643621@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @-0.653643621@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @-0.416146837@ then + if $data80 != @-0.416146837@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select cos(c3),tbname from stb1; +sql select cos(c3),tbname from stb1; +if $data00 != @0.540302306@ 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 != @-0.989992497@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @0.982263352@ then + return -1 +endi +if $data51 != @tb1@ then + return -1 +endi +if $data60 != @0.982263352@ then + return -1 +endi +if $data61 != @tb1@ then + return -1 +endi +if $data70 != @0.540302306@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @-0.416146837@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @-0.989992497@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select cos(c3),tbname from stb1 where t1 > 1; +sql select cos(c3),tbname from stb1 where t1 > 1; +if $data00 != @0.540302306@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @-0.416146837@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @-0.989992497@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @-0.653643621@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @0.283662185@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @0.960170287@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @0.753902254@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select cos(c8),cos(c9) from tbn; +sql_error select cos(c8),cos(c9) from tbn; +print execute sql select cos(c8),cos(c9) from tbn order by ts desc; +sql_error select cos(c8),cos(c9) from tbn order by ts desc; +print execute sql select cos(cos(c8)) from tbn; +sql_error select cos(cos(c8)) from tbn; +print execute sql select cos(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select cos(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @-0.416146837@ then + return -1 +endi +if $data20 != @-0.801143616@ then + return -1 +endi +if $data30 != @-0.653643621@ then + return -1 +endi +if $data40 != @-0.210795799@ then + return -1 +endi +if $data50 != @-0.864543874@ then + return -1 +endi +if $data60 != @-0.952412980@ then + return -1 +endi +print execute sql select cos(c2) from (select * from stb1); +sql select cos(c2) from (select * from stb1); +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.232359102@ then + return -1 +endi +if $data60 != @0.232359102@ then + return -1 +endi +if $data70 != @0.540302306@ then + return -1 +endi +if $data80 != @-0.416146837@ then + return -1 +endi +if $data90 != @-0.989992497@ then + return -1 +endi +print execute sql select cos(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 select cos(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)); +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @-0.416146837@ then + return -1 +endi +if $data20 != @-0.801143616@ then + return -1 +endi +if $data30 != @-0.653643621@ then + return -1 +endi +if $data40 != @-0.210795799@ then + return -1 +endi +if $data50 != @-0.864543874@ then + return -1 +endi +if $data60 != @-0.952412980@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select cos(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 select cos(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; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @-0.416146837@ then + return -1 +endi +if $data20 != @-0.801143616@ then + return -1 +endi +if $data30 != @-0.653643621@ then + return -1 +endi +if $data40 != @-0.210795799@ then + return -1 +endi +if $data50 != @-0.864543874@ then + return -1 +endi +if $data60 != @-0.952412980@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select cos(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 select cos(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.952412980@ then + return -1 +endi +if $data40 != @-0.864543874@ then + return -1 +endi +if $data50 != @-0.210795799@ then + return -1 +endi +if $data60 != @-0.653643621@ then + return -1 +endi +if $data70 != @-0.801143616@ then + return -1 +endi +if $data80 != @-0.416146837@ then + return -1 +endi +if $data90 != @0.540302306@ then + return -1 +endi +print execute sql select cos(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 select cos(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.864543874@ then + return -1 +endi +if $data40 != @-0.210795799@ then + return -1 +endi +if $data50 != @-0.653643621@ then + return -1 +endi +if $data60 != @-0.801143616@ then + return -1 +endi +if $data70 != @-0.416146837@ then + return -1 +endi +if $data80 != @0.540302306@ then + return -1 +endi +if $data90 != @-0.952412980@ then + return -1 +endi +print execute sql select cos(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 select cos(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; +if $data00 != @-0.952412980@ then + return -1 +endi +if $data10 != @0.540302306@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @-0.801143616@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @-0.210795799@ then + return -1 +endi +if $data60 != @-0.864543874@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select cos(a) from (select cos(c2) as a from tb1); +sql select cos(a) from (select cos(c2) as a from tb1); +if $data00 != @0.857553216@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.914653326@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.793873449@ then + return -1 +endi +if $data50 != @0.973125864@ then + return -1 +endi +if $data60 != @0.973125864@ then + return -1 +endi +print execute sql select cos(tb1.c3),cos(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select cos(tb1.c3),cos(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @0.540302306@ then + return -1 +endi +if $data01 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @-0.416146837@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @-0.989992497@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data31 != @-0.653643621@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data41 != @0.283662185@ then + return -1 +endi +if $data50 != @0.982263352@ then + return -1 +endi +if $data51 != @0.960170287@ then + return -1 +endi +if $data60 != @0.982263352@ then + return -1 +endi +if $data61 != @0.753902254@ then + return -1 +endi +print execute sql select cos(c3) from tb1 union all select cos(c3) from tb2; +sql select cos(c3) from tb1 union all select cos(c3) from tb2; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.982263352@ then + return -1 +endi +if $data60 != @0.982263352@ then + return -1 +endi +if $data70 != @0.540302306@ then + return -1 +endi +if $data80 != @-0.416146837@ then + return -1 +endi +if $data90 != @-0.989992497@ then + return -1 +endi diff --git a/tests/script/general/compute/math_cos2.sim b/tests/script/general/compute/math_cos2.sim new file mode 100644 index 0000000000..ab263cfac0 --- /dev/null +++ b/tests/script/general/compute/math_cos2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select cos(stb1.c4),cos(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select cos(stb1.c4),cos(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @0.540302306@ then + return -1 +endi +if $data01 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @-0.416146837@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data21 != @-0.989992497@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @-0.653643621@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data41 != @0.283662185@ then + return -1 +endi +if $data50 != @-0.688836692@ then + return -1 +endi +if $data51 != @0.960170287@ then + return -1 +endi +if $data60 != @-0.688836692@ then + return -1 +endi +if $data61 != @0.753902254@ then + return -1 +endi +print execute sql select cos(c4) as a from stb1 union all select cos(c5) as a from stba; +sql select cos(c4) as a from stb1 union all select cos(c5) as a from stba; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @-0.688836692@ then + return -1 +endi +if $data60 != @-0.688836692@ then + return -1 +endi +if $data70 != @0.540302306@ then + return -1 +endi +if $data80 != @-0.416146837@ then + return -1 +endi +if $data90 != @-0.416146837@ then + return -1 +endi +print execute sql select cos(c2) from stba; +sql select cos(c2) from stba; +if $data00 != @0.540302306@ then + return -1 +endi +if $data10 != @-0.416146837@ then + return -1 +endi +if $data20 != @-0.989992497@ then + return -1 +endi +if $data30 != @-0.653643621@ then + return -1 +endi +if $data40 != @0.283662185@ then + return -1 +endi +if $data50 != @0.960170287@ then + return -1 +endi +if $data60 != @0.753902254@ then + return -1 +endi +if $data70 != @-0.145500034@ then + return -1 +endi +if $data80 != @-0.911130262@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi +print execute sql select cos(min(c2)) from tba1; +sql select cos(min(c2)) from tba1; +if $data00 != @1.000000000@ then + return -1 +endi +print execute sql select cos(max(c2)) from tba1; +sql select cos(max(c2)) from tba1; +if $data00 != @-0.911130262@ then + return -1 +endi +print execute sql select cos(count(c2)) from tba1; +sql select cos(count(c2)) from tba1; +if $data00 != @0.154251450@ then + return -1 +endi +print execute sql select cos(sum(c2)) from tba1; +sql select cos(sum(c2)) from tba1; +if $data00 != @-0.996087835@ then + return -1 +endi +print execute sql select cos(avg(c2)) from tba1; +sql select cos(avg(c2)) from tba1; +if $data00 != @-0.210795799@ then + return -1 +endi +print execute sql select cos(percentile(c2, 10)) from tba1; +sql select cos(percentile(c2, 10)) from tba1; +if $data00 != @0.621609968@ then + return -1 +endi +print execute sql select cos(apercentile(c2, 10)) from tba1; +sql select cos(apercentile(c2, 10)) from tba1; +if $data00 != @1.000000000@ then + return -1 +endi +print execute sql select cos(stddev(c2)) from tba1; +sql select cos(stddev(c2)) from tba1; +if $data00 != @-0.963954358@ then + return -1 +endi +print execute sql select cos(spread(c2)) from tba1; +sql select cos(spread(c2)) from tba1; +if $data00 != @-0.911130262@ then + return -1 +endi +print execute sql select cos(twa(c2)) from tba1; +sql select cos(twa(c2)) from tba1; +if $data00 != @-0.074389166@ then + return -1 +endi +print execute sql select cos(leastsquares(c2, 1, 1)) from tba1; +sql_error select cos(leastsquares(c2, 1, 1)) from tba1; +print execute sql select cos(interp(c2)) from tba1 every(1s) +sql select cos(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.540302306@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @-0.416146837@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @-0.989992497@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @-0.653643621@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @0.283662185@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @0.960170287@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @0.753902254@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @-0.145500034@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @-0.911130262@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @1.000000000@ then + return -1 +endi +print execute sql select cos(interp(c2)) from stba every(1s) group by tbname; +sql select cos(interp(c2)) from stba every(1s) group by tbname; +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.540302306@ then + return -1 +endi +if $data02 != @tba1@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @-0.416146837@ then + return -1 +endi +if $data12 != @tba1@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @-0.989992497@ then + return -1 +endi +if $data22 != @tba1@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @-0.653643621@ then + return -1 +endi +if $data32 != @tba1@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @0.283662185@ then + return -1 +endi +if $data42 != @tba1@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @0.960170287@ then + return -1 +endi +if $data52 != @tba1@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @0.753902254@ then + return -1 +endi +if $data62 != @tba1@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @-0.145500034@ then + return -1 +endi +if $data72 != @tba1@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @-0.911130262@ then + return -1 +endi +if $data82 != @tba1@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @1.000000000@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select cos(elapsed(ts)) from tba1; +sql select cos(elapsed(ts)) from tba1; +if $data00 != @-0.999127122@ then + return -1 +endi +print execute sql select cos(rate(c2)) from tba1; +sql select cos(rate(c2)) from tba1; +if $data00 != @0.624307395@ then + return -1 +endi +print execute sql select cos(irate(c2)) from tba1; +sql select cos(irate(c2)) from tba1; +if $data00 != @1.000000000@ then + return -1 +endi +print execute sql select cos(first(c2)) from tba1; +sql select cos(first(c2)) from tba1; +if $data00 != @0.540302306@ then + return -1 +endi +print execute sql select cos(last(c2)) from tba1; +sql select cos(last(c2)) from tba1; +if $data00 != @1.000000000@ then + return -1 +endi +print execute sql select cos(last_row(c2)) from tba1; +sql select cos(last_row(c2)) from tba1; +if $data00 != @1.000000000@ then + return -1 +endi +print execute sql select cos(top(c2, 1)) from tba1; +sql_error select cos(top(c2, 1)) from tba1; +print execute sql select cos(bottom(c2, 1)) from tba1; +sql_error select cos(bottom(c2, 1)) from tba1; +print execute sql select cos(leastsquares(c2, 1, 1)) from tba1; +sql_error select cos(leastsquares(c2, 1, 1)) from tba1; +print execute sql select cos(derivative(c2, 1s, 0)) from tba1; +sql_error select cos(derivative(c2, 1s, 0)) from tba1; +print execute sql select cos(diff(c2)) from tba1; +sql_error select cos(diff(c2)) from tba1; +print execute sql select cos(csum(c2)) from tba1; +sql_error select cos(csum(c2)) from tba1; +print execute sql select cos(mavg(c2,2)) from tba1; +sql_error select cos(mavg(c2,2)) from tba1; +print execute sql select cos(sample(c2,2)) from tba1; +sql_error select cos(sample(c2,2)) from tba1; +print execute sql select cos(_block_dist()) from tba1; +sql_error select cos(_block_dist()) from tba1; diff --git a/tests/script/general/compute/math_sin.sim b/tests/script/general/compute/math_sin.sim new file mode 100644 index 0000000000..d014324fa1 --- /dev/null +++ b/tests/script/general/compute/math_sin.sim @@ -0,0 +1,1073 @@ +sleep 100 +sql connect +sql use db + +print execute sql select sin(*) from tb1; +sql_error select sin(*) from tb1; +print execute sql select sin(*) from tb1; +sql_error select sin(*) from tb1; +print execute sql select sin(*) from tb1; +sql_error select sin(*) from tb1; +print execute sql select sin(*) from tb1; +sql_error select sin(*) from tb1; +print execute sql select sin(*) as a from tb1; +sql_error select sin(*) as a from tb1; +print execute sql select sin(*) + 1 as a from tb1; +sql_error select sin(*) + 1 as a from tb1; +print execute sql select sin(tb1.*) + 1 as a from tb1; +sql_error select sin(tb1.*) + 1 as a from tb1; +print execute sql select sin(*) from tb1; +sql_error select sin(*) from tb1; +print execute sql select sin(c1) from tb1; +sql_error select sin(c1) from tb1; +print execute sql select sin(c1) from tb1; +sql_error select sin(c1) from tb1; +print execute sql select sin(c1 + c2) from tb1; +sql_error select sin(c1 + c2) from tb1; +print execute sql select sin(13) from tb1; +sql select sin(13) from tb1; +if $data00 != @0.420167037@ then + return -1 +endi +if $data10 != @0.420167037@ then + return -1 +endi +if $data20 != @0.420167037@ then + return -1 +endi +if $data30 != @0.420167037@ then + return -1 +endi +if $data40 != @0.420167037@ then + return -1 +endi +if $data50 != @0.420167037@ then + return -1 +endi +if $data60 != @0.420167037@ then + return -1 +endi +print execute sql select sin(c1) from tb1; +sql_error select sin(c1) from tb1; +print execute sql select sin(c2) from tb1; +sql select sin(c2) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.972630067@ then + return -1 +endi +if $data60 != @-0.972630067@ then + return -1 +endi +print execute sql select sin(c3) from tb1; +sql select sin(c3) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.187506554@ then + return -1 +endi +if $data60 != @-0.187506554@ then + return -1 +endi +print execute sql select sin(c4) from tb1; +sql select sin(c4) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @-0.724916555@ then + return -1 +endi +if $data60 != @0.724916555@ then + return -1 +endi +print execute sql select sin(c5) from tb1; +sql select sin(c5) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.999930377@ then + return -1 +endi +if $data60 != @-0.999930377@ then + return -1 +endi +print execute sql select sin(c6) from tb1; +sql select sin(c6) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @-0.521876523@ then + return -1 +endi +if $data60 != @0.521876523@ then + return -1 +endi +print execute sql select sin(c7) from tb1; +sql select sin(c7) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.872829297@ then + return -1 +endi +if $data60 != @-0.872829297@ then + return -1 +endi +print execute sql select sin(c8) from tb1; +sql_error select sin(c8) from tb1; +print execute sql select sin(c9) from tb1; +sql_error select sin(c9) from tb1; +print execute sql select sin(c10) from tb1; +sql select sin(c10) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.451998898@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select sin(c11) from tb1; +sql select sin(c11) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.368361632@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select sin(c12) from tb1; +sql select sin(c12) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.998698243@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select sin(c13) from tb1; +sql select sin(c13) from tb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.999930377@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select sin(12345678900000000000000000) from tb1; +sql_error select sin(12345678900000000000000000) from tb1; +print execute sql select distinct sin(123) from tb1; +sql_error select distinct sin(123) from tb1; +print execute sql select sin(t1) from stb1; +sql_error select sin(t1) from stb1; +print execute sql select sin(c1),avg(c3) from tb1; +sql_error select sin(c1),avg(c3) from tb1; +print execute sql select sin(c1),top(c3,1) from tb1; +sql_error select sin(c1),top(c3,1) from tb1; +print execute sql select sin(c2+c3) from tb1 session(ts, 1s); +sql_error select sin(c2+c3) from tb1 session(ts, 1s); +print execute sql select sin(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select sin(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select sin(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select sin(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select sin(c2+c3) from stb1 group by t1; +sql_error select sin(c2+c3) from stb1 group by t1; +print execute sql select sin(c2+c3) from stb1 group by ts; +sql_error select sin(c2+c3) from stb1 group by ts; +print execute sql select sin(c2+c3) from stb1 group by c1; +sql_error select sin(c2+c3) from stb1 group by c1; +print execute sql select sin(c2+c3) from stb1 group by tbname; +sql_error select sin(c2+c3) from stb1 group by tbname; +print execute sql select sin(c2+c3) from tb1 order by c2; +sql_error select sin(c2+c3) from tb1 order by c2; +print execute sql select sin(c8),sin(c9) from tbn; +sql_error select sin(c8),sin(c9) from tbn; +print execute sql select sin(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select sin(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select sin(a) from (select sin(c2) as a from tb1); +sql select sin(a) from (select sin(c2) as a from tb1); +if $data00 != @0.745624142@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.789072344@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.686600261@ then + return -1 +endi +if $data50 != @0.826369634@ then + return -1 +endi +if $data60 != @-0.826369634@ then + return -1 +endi +print execute sql select sin("abc") from tb1; +sql_error select sin("abc") from tb1; +print execute sql select sin(c2 + c3) from tb1; +sql select sin(c2 + c3) from tb1; +if $data00 != @0.909297427@ 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.989358247@ then + return -1 +endi +if $data50 != @0.998947724@ then + return -1 +endi +if $data60 != @-0.998947724@ then + return -1 +endi +print execute sql select sin((c2 + c3)) from tb1; +sql select sin((c2 + c3)) from tb1; +if $data00 != @0.909297427@ 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.989358247@ then + return -1 +endi +if $data50 != @0.998947724@ then + return -1 +endi +if $data60 != @-0.998947724@ then + return -1 +endi +print execute sql select sin((c2 * c3)+c4-6) from tb1; +sql select sin((c2 * c3)+c4-6) from tb1; +if $data00 != @0.756802495@ 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.990607356@ then + return -1 +endi +if $data50 != @0.083417203@ then + return -1 +endi +if $data60 != @0.990962545@ then + return -1 +endi +print execute sql select sin(11)+c2 from tb1; +sql select sin(11)+c2 from tb1; +if $data00 != @0.000009793@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.000009793@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @3.000009793@ then + return -1 +endi +if $data50 != @126.000009793@ then + return -1 +endi +if $data60 != @-127.999990207@ then + return -1 +endi +print execute sql select sin(c1)+c2 from tb1; +sql_error select sin(c1)+c2 from tb1; +print execute sql select sin(c2)+11 from tb1; +sql select sin(c2)+11 from tb1; +if $data00 != @11.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @11.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @10.243197505@ then + return -1 +endi +if $data50 != @11.972630067@ then + return -1 +endi +if $data60 != @10.027369933@ then + return -1 +endi +print execute sql select sin(c1),c1,c2 from tb1; +sql_error select sin(c1),c1,c2 from tb1; +print execute sql select sin(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select sin(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select sin(c1),floor(c3) from tb1; +sql_error select sin(c1),floor(c3) from tb1; +print execute sql select sin(c1),sin(c2+c3) from tb1; +sql_error select sin(c1),sin(c2+c3) from tb1; +print execute sql select sin(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select sin(c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @0.909297427@ then + return -1 +endi +if $data10 != @0.989358247@ then + return -1 +endi +if $data20 != @0.998947724@ then + return -1 +endi +if $data30 != @-0.998947724@ then + return -1 +endi +print execute sql select sin(c2) from tb1 order by ts desc; +sql select sin(c2) from tb1 order by ts desc; +if $data00 != @-0.972630067@ then + return -1 +endi +if $data10 != @0.972630067@ then + return -1 +endi +if $data20 != @-0.756802495@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @0.909297427@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @0.841470985@ then + return -1 +endi +print execute sql select sin(c2+c3) from tb1 order by ts desc; +sql select sin(c2+c3) from tb1 order by ts desc; +if $data00 != @-0.998947724@ then + return -1 +endi +if $data10 != @0.998947724@ then + return -1 +endi +if $data20 != @0.989358247@ 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.909297427@ then + return -1 +endi +print execute sql select sin(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select sin(c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @0.989358247@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select sin(c2) from stb1; +sql select sin(c2) from stb1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.972630067@ then + return -1 +endi +if $data60 != @-0.972630067@ then + return -1 +endi +if $data70 != @0.841470985@ then + return -1 +endi +if $data80 != @0.909297427@ then + return -1 +endi +if $data90 != @0.141120008@ then + return -1 +endi +print execute sql select sin(c2) from stb1 order by ts desc; +sql select sin(c2) from stb1 order by ts desc; +if $data00 != @0.656986599@ then + if $data00 != @-0.972630067@ then + return -1 + endi +endi +if $data20 != @-0.279415498@ then + if $data20 != @0.972630067@ then + return -1 + endi +endi +if $data40 != @-0.958924275@ then + if $data40 != @-0.756802495@ then + return -1 + endi +endi +if $data60 != @-0.756802495@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @0.141120008@ then + if $data80 != @0.909297427@ then + return -1 + endi +endi +print execute sql select sin(c4),t1 from stb1 order by ts desc; +sql select sin(c4),t1 from stb1 order by ts desc; +if $data00 != @0.656986599@ then + if $data00 != @0.724916555@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @-0.279415498@ then + if $data20 != @-0.724916555@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @-0.958924275@ then + if $data40 != @-0.756802495@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @-0.756802495@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @0.909297427@ then + if $data80 != @0.909297427@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select sin(c3),tbname from stb1; +sql select sin(c3),tbname from stb1; +if $data00 != @0.841470985@ 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 != @0.141120008@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @0.187506554@ then + return -1 +endi +if $data51 != @tb1@ then + return -1 +endi +if $data60 != @-0.187506554@ then + return -1 +endi +if $data61 != @tb1@ then + return -1 +endi +if $data70 != @0.841470985@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @0.909297427@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @0.141120008@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select sin(c3),tbname from stb1 where t1 > 1; +sql select sin(c3),tbname from stb1 where t1 > 1; +if $data00 != @0.841470985@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @0.909297427@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @0.141120008@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @-0.756802495@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @-0.958924275@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @-0.279415498@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @0.656986599@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select sin(c8),sin(c9) from tbn; +sql_error select sin(c8),sin(c9) from tbn; +print execute sql select sin(c8),sin(c9) from tbn order by ts desc; +sql_error select sin(c8),sin(c9) from tbn order by ts desc; +print execute sql select sin(sin(c8)) from tbn; +sql_error select sin(sin(c8)) from tbn; +print execute sql select sin(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select sin(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @0.909297427@ then + return -1 +endi +if $data20 != @0.598472144@ then + return -1 +endi +if $data30 != @-0.756802495@ then + return -1 +endi +if $data40 != @-0.977530118@ then + return -1 +endi +if $data50 != @-0.502557350@ then + return -1 +endi +if $data60 != @0.304810621@ then + return -1 +endi +print execute sql select sin(c2) from (select * from stb1); +sql select sin(c2) from (select * from stb1); +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.972630067@ then + return -1 +endi +if $data60 != @-0.972630067@ then + return -1 +endi +if $data70 != @0.841470985@ then + return -1 +endi +if $data80 != @0.909297427@ then + return -1 +endi +if $data90 != @0.141120008@ then + return -1 +endi +print execute sql select sin(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 select sin(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)); +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @0.909297427@ then + return -1 +endi +if $data20 != @0.598472144@ then + return -1 +endi +if $data30 != @-0.756802495@ then + return -1 +endi +if $data40 != @-0.977530118@ then + return -1 +endi +if $data50 != @-0.502557350@ then + return -1 +endi +if $data60 != @0.304810621@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select sin(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 select sin(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; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @0.909297427@ then + return -1 +endi +if $data20 != @0.598472144@ then + return -1 +endi +if $data30 != @-0.756802495@ then + return -1 +endi +if $data40 != @-0.977530118@ then + return -1 +endi +if $data50 != @-0.502557350@ then + return -1 +endi +if $data60 != @0.304810621@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select sin(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 select sin(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.304810621@ then + return -1 +endi +if $data40 != @-0.502557350@ then + return -1 +endi +if $data50 != @-0.977530118@ then + return -1 +endi +if $data60 != @-0.756802495@ then + return -1 +endi +if $data70 != @0.598472144@ then + return -1 +endi +if $data80 != @0.909297427@ then + return -1 +endi +if $data90 != @0.841470985@ then + return -1 +endi +print execute sql select sin(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 select sin(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.502557350@ then + return -1 +endi +if $data40 != @-0.977530118@ then + return -1 +endi +if $data50 != @-0.756802495@ then + return -1 +endi +if $data60 != @0.598472144@ then + return -1 +endi +if $data70 != @0.909297427@ then + return -1 +endi +if $data80 != @0.841470985@ then + return -1 +endi +if $data90 != @0.304810621@ then + return -1 +endi +print execute sql select sin(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 select sin(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; +if $data00 != @0.304810621@ then + return -1 +endi +if $data10 != @0.841470985@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @0.598472144@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @-0.977530118@ then + return -1 +endi +if $data60 != @-0.502557350@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select sin(a) from (select sin(c2) as a from tb1); +sql select sin(a) from (select sin(c2) as a from tb1); +if $data00 != @0.745624142@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.789072344@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.686600261@ then + return -1 +endi +if $data50 != @0.826369634@ then + return -1 +endi +if $data60 != @-0.826369634@ then + return -1 +endi +print execute sql select sin(tb1.c3),sin(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select sin(tb1.c3),sin(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @0.841470985@ then + return -1 +endi +if $data01 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @0.909297427@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @0.141120008@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data31 != @-0.756802495@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data41 != @-0.958924275@ then + return -1 +endi +if $data50 != @0.187506554@ then + return -1 +endi +if $data51 != @-0.279415498@ then + return -1 +endi +if $data60 != @-0.187506554@ then + return -1 +endi +if $data61 != @0.656986599@ then + return -1 +endi +print execute sql select sin(c3) from tb1 union all select sin(c3) from tb2; +sql select sin(c3) from tb1 union all select sin(c3) from tb2; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.141120008@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @0.187506554@ then + return -1 +endi +if $data60 != @-0.187506554@ then + return -1 +endi +if $data70 != @0.841470985@ then + return -1 +endi +if $data80 != @0.909297427@ then + return -1 +endi +if $data90 != @0.141120008@ then + return -1 +endi diff --git a/tests/script/general/compute/math_sin2.sim b/tests/script/general/compute/math_sin2.sim new file mode 100644 index 0000000000..f19fa3c835 --- /dev/null +++ b/tests/script/general/compute/math_sin2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select sin(stb1.c4),sin(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select sin(stb1.c4),sin(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @0.841470985@ then + return -1 +endi +if $data01 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @0.909297427@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data21 != @0.141120008@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @-0.756802495@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data41 != @-0.958924275@ then + return -1 +endi +if $data50 != @-0.724916555@ then + return -1 +endi +if $data51 != @-0.279415498@ then + return -1 +endi +if $data60 != @0.724916555@ then + return -1 +endi +if $data61 != @0.656986599@ then + return -1 +endi +print execute sql select sin(c4) as a from stb1 union all select sin(c5) as a from stba; +sql select sin(c4) as a from stb1 union all select sin(c5) as a from stba; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @0.909297427@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-0.756802495@ then + return -1 +endi +if $data50 != @-0.724916555@ then + return -1 +endi +if $data60 != @0.724916555@ then + return -1 +endi +if $data70 != @0.841470985@ then + return -1 +endi +if $data80 != @0.909297427@ then + return -1 +endi +if $data90 != @0.909297427@ then + return -1 +endi +print execute sql select sin(c2) from stba; +sql select sin(c2) from stba; +if $data00 != @0.841470985@ then + return -1 +endi +if $data10 != @0.909297427@ then + return -1 +endi +if $data20 != @0.141120008@ then + return -1 +endi +if $data30 != @-0.756802495@ then + return -1 +endi +if $data40 != @-0.958924275@ then + return -1 +endi +if $data50 != @-0.279415498@ then + return -1 +endi +if $data60 != @0.656986599@ then + return -1 +endi +if $data70 != @0.989358247@ then + return -1 +endi +if $data80 != @0.412118485@ then + return -1 +endi +if $data90 != @0.000000000@ then + return -1 +endi +print execute sql select sin(min(c2)) from tba1; +sql select sin(min(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sin(max(c2)) from tba1; +sql select sin(max(c2)) from tba1; +if $data00 != @0.412118485@ then + return -1 +endi +print execute sql select sin(count(c2)) from tba1; +sql select sin(count(c2)) from tba1; +if $data00 != @-0.988031624@ then + return -1 +endi +print execute sql select sin(sum(c2)) from tba1; +sql select sin(sum(c2)) from tba1; +if $data00 != @0.088368686@ then + return -1 +endi +print execute sql select sin(avg(c2)) from tba1; +sql select sin(avg(c2)) from tba1; +if $data00 != @-0.977530118@ then + return -1 +endi +print execute sql select sin(percentile(c2, 10)) from tba1; +sql select sin(percentile(c2, 10)) from tba1; +if $data00 != @0.783326910@ then + return -1 +endi +print execute sql select sin(apercentile(c2, 10)) from tba1; +sql select sin(apercentile(c2, 10)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sin(stddev(c2)) from tba1; +sql select sin(stddev(c2)) from tba1; +if $data00 != @0.266067654@ then + return -1 +endi +print execute sql select sin(spread(c2)) from tba1; +sql select sin(spread(c2)) from tba1; +if $data00 != @0.412118485@ then + return -1 +endi +print execute sql select sin(twa(c2)) from tba1; +sql select sin(twa(c2)) from tba1; +if $data00 != @-0.997229288@ then + return -1 +endi +print execute sql select sin(leastsquares(c2, 1, 1)) from tba1; +sql_error select sin(leastsquares(c2, 1, 1)) from tba1; +print execute sql select sin(interp(c2)) from tba1 every(1s) +sql select sin(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.841470985@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @0.909297427@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @0.141120008@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @-0.756802495@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @-0.958924275@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @-0.279415498@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @0.656986599@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @0.989358247@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @0.412118485@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @0.000000000@ then + return -1 +endi +print execute sql select sin(interp(c2)) from stba every(1s) group by tbname; +sql select sin(interp(c2)) from stba every(1s) group by tbname; +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @0.841470985@ then + return -1 +endi +if $data02 != @tba1@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @0.909297427@ then + return -1 +endi +if $data12 != @tba1@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @0.141120008@ then + return -1 +endi +if $data22 != @tba1@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @-0.756802495@ then + return -1 +endi +if $data32 != @tba1@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @-0.958924275@ then + return -1 +endi +if $data42 != @tba1@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @-0.279415498@ then + return -1 +endi +if $data52 != @tba1@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @0.656986599@ then + return -1 +endi +if $data62 != @tba1@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @0.989358247@ then + return -1 +endi +if $data72 != @tba1@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @0.412118485@ then + return -1 +endi +if $data82 != @tba1@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @0.000000000@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select sin(elapsed(ts)) from tba1; +sql select sin(elapsed(ts)) from tba1; +if $data00 != @0.041773129@ then + return -1 +endi +print execute sql select sin(rate(c2)) from tba1; +sql select sin(rate(c2)) from tba1; +if $data00 != @0.781178774@ then + return -1 +endi +print execute sql select sin(irate(c2)) from tba1; +sql select sin(irate(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sin(first(c2)) from tba1; +sql select sin(first(c2)) from tba1; +if $data00 != @0.841470985@ then + return -1 +endi +print execute sql select sin(last(c2)) from tba1; +sql select sin(last(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sin(last_row(c2)) from tba1; +sql select sin(last_row(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sin(top(c2, 1)) from tba1; +sql_error select sin(top(c2, 1)) from tba1; +print execute sql select sin(bottom(c2, 1)) from tba1; +sql_error select sin(bottom(c2, 1)) from tba1; +print execute sql select sin(leastsquares(c2, 1, 1)) from tba1; +sql_error select sin(leastsquares(c2, 1, 1)) from tba1; +print execute sql select sin(derivative(c2, 1s, 0)) from tba1; +sql_error select sin(derivative(c2, 1s, 0)) from tba1; +print execute sql select sin(diff(c2)) from tba1; +sql_error select sin(diff(c2)) from tba1; +print execute sql select sin(csum(c2)) from tba1; +sql_error select sin(csum(c2)) from tba1; +print execute sql select sin(mavg(c2,2)) from tba1; +sql_error select sin(mavg(c2,2)) from tba1; +print execute sql select sin(sample(c2,2)) from tba1; +sql_error select sin(sample(c2,2)) from tba1; +print execute sql select sin(_block_dist()) from tba1; +sql_error select sin(_block_dist()) from tba1; diff --git a/tests/script/general/compute/math_str_func.sim b/tests/script/general/compute/math_str_func.sim index 71fc05859e..d40d387248 100644 --- a/tests/script/general/compute/math_str_func.sim +++ b/tests/script/general/compute/math_str_func.sim @@ -48,6 +48,11 @@ sql insert into tbn values ('2021-11-11 09:00:06',true,7,7,7,7,7,7,"777","7777", run general/compute/math_sqrt.sim run general/compute/math_abs.sim run general/compute/math_asin.sim +run general/compute/math_acos.sim +run general/compute/math_atan.sim +run general/compute/math_sin.sim +run general/compute/math_cos.sim +run general/compute/math_tan.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); @@ -105,6 +110,16 @@ run general/compute/math_abs.sim run general/compute/math_abs2.sim run general/compute/math_asin.sim run general/compute/math_asin2.sim +run general/compute/math_acos.sim +run general/compute/math_acos2.sim +run general/compute/math_atan.sim +run general/compute/math_atan2.sim +run general/compute/math_sin.sim +run general/compute/math_sin2.sim +run general/compute/math_cos.sim +run general/compute/math_cos2.sim +run general/compute/math_tan.sim +run general/compute/math_tan2.sim #system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/compute/math_tan.sim b/tests/script/general/compute/math_tan.sim new file mode 100644 index 0000000000..d6f3a99230 --- /dev/null +++ b/tests/script/general/compute/math_tan.sim @@ -0,0 +1,1073 @@ +sleep 100 +sql connect +sql use db + +print execute sql select tan(*) from tb1; +sql_error select tan(*) from tb1; +print execute sql select tan(*) from tb1; +sql_error select tan(*) from tb1; +print execute sql select tan(*) from tb1; +sql_error select tan(*) from tb1; +print execute sql select tan(*) from tb1; +sql_error select tan(*) from tb1; +print execute sql select tan(*) as a from tb1; +sql_error select tan(*) as a from tb1; +print execute sql select tan(*) + 1 as a from tb1; +sql_error select tan(*) + 1 as a from tb1; +print execute sql select tan(tb1.*) + 1 as a from tb1; +sql_error select tan(tb1.*) + 1 as a from tb1; +print execute sql select tan(*) from tb1; +sql_error select tan(*) from tb1; +print execute sql select tan(c1) from tb1; +sql_error select tan(c1) from tb1; +print execute sql select tan(c1) from tb1; +sql_error select tan(c1) from tb1; +print execute sql select tan(c1 + c2) from tb1; +sql_error select tan(c1 + c2) from tb1; +print execute sql select tan(13) from tb1; +sql select tan(13) from tb1; +if $data00 != @0.463021133@ then + return -1 +endi +if $data10 != @0.463021133@ then + return -1 +endi +if $data20 != @0.463021133@ then + return -1 +endi +if $data30 != @0.463021133@ then + return -1 +endi +if $data40 != @0.463021133@ then + return -1 +endi +if $data50 != @0.463021133@ then + return -1 +endi +if $data60 != @0.463021133@ then + return -1 +endi +print execute sql select tan(c1) from tb1; +sql_error select tan(c1) from tb1; +print execute sql select tan(c2) from tb1; +sql select tan(c2) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @4.185891832@ then + return -1 +endi +if $data60 != @-4.185891832@ then + return -1 +endi +print execute sql select tan(c3) from tb1; +sql select tan(c3) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @0.190892344@ then + return -1 +endi +if $data60 != @-0.190892344@ then + return -1 +endi +print execute sql select tan(c4) from tb1; +sql select tan(c4) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @1.052377964@ then + return -1 +endi +if $data60 != @-1.052377964@ then + return -1 +endi +print execute sql select tan(c5) from tb1; +sql select tan(c5) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @84.739312969@ then + return -1 +endi +if $data60 != @-84.739312969@ then + return -1 +endi +print execute sql select tan(c6) from tb1; +sql select tan(c6) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @-0.611797950@ then + return -1 +endi +if $data60 != @0.611797950@ then + return -1 +endi +print execute sql select tan(c7) from tb1; +sql select tan(c7) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @1.788490683@ then + return -1 +endi +if $data60 != @-1.788490683@ then + return -1 +endi +print execute sql select tan(c8) from tb1; +sql_error select tan(c8) from tb1; +print execute sql select tan(c9) from tb1; +sql_error select tan(c9) from tb1; +print execute sql select tan(c10) from tb1; +sql select tan(c10) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @-0.506714715@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select tan(c11) from tb1; +sql select tan(c11) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @0.396223010@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select tan(c12) from tb1; +sql select tan(c12) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @-19.579238092@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select tan(c13) from tb1; +sql select tan(c13) from tb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @84.739312969@ then + return -1 +endi +if $data60 != @0.000000000@ then + return -1 +endi +print execute sql select tan(12345678900000000000000000) from tb1; +sql_error select tan(12345678900000000000000000) from tb1; +print execute sql select distinct tan(123) from tb1; +sql_error select distinct tan(123) from tb1; +print execute sql select tan(t1) from stb1; +sql_error select tan(t1) from stb1; +print execute sql select tan(c1),avg(c3) from tb1; +sql_error select tan(c1),avg(c3) from tb1; +print execute sql select tan(c1),top(c3,1) from tb1; +sql_error select tan(c1),top(c3,1) from tb1; +print execute sql select tan(c2+c3) from tb1 session(ts, 1s); +sql_error select tan(c2+c3) from tb1 session(ts, 1s); +print execute sql select tan(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select tan(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select tan(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select tan(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select tan(c2+c3) from stb1 group by t1; +sql_error select tan(c2+c3) from stb1 group by t1; +print execute sql select tan(c2+c3) from stb1 group by ts; +sql_error select tan(c2+c3) from stb1 group by ts; +print execute sql select tan(c2+c3) from stb1 group by c1; +sql_error select tan(c2+c3) from stb1 group by c1; +print execute sql select tan(c2+c3) from stb1 group by tbname; +sql_error select tan(c2+c3) from stb1 group by tbname; +print execute sql select tan(c2+c3) from tb1 order by c2; +sql_error select tan(c2+c3) from tb1 order by c2; +print execute sql select tan(c8),tan(c9) from tbn; +sql_error select tan(c8),tan(c9) from tbn; +print execute sql select tan(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select tan(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select tan(a) from (select tan(c2) as a from tb1); +sql select tan(a) from (select tan(c2) as a from tb1); +if $data00 != @74.685933399@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.417928576@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @2.282204450@ then + return -1 +endi +if $data50 != @1.720515194@ then + return -1 +endi +if $data60 != @-1.720515194@ then + return -1 +endi +print execute sql select tan("abc") from tb1; +sql_error select tan("abc") from tb1; +print execute sql select tan(c2 + c3) from tb1; +sql select tan(c2 + c3) from tb1; +if $data00 != @-2.185039863@ 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 != @-6.799711455@ then + return -1 +endi +if $data50 != @21.780973629@ then + return -1 +endi +if $data60 != @-21.780973629@ then + return -1 +endi +print execute sql select tan((c2 + c3)) from tb1; +sql select tan((c2 + c3)) from tb1; +if $data00 != @-2.185039863@ 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 != @-6.799711455@ then + return -1 +endi +if $data50 != @21.780973629@ then + return -1 +endi +if $data60 != @-21.780973629@ then + return -1 +endi +print execute sql select tan((c2 * c3)+c4-6) from tb1; +sql select tan((c2 * c3)+c4-6) from tb1; +if $data00 != @-1.157821282@ 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 != @7.244606616@ then + return -1 +endi +if $data50 != @-0.083708953@ then + return -1 +endi +if $data60 != @7.387587308@ then + return -1 +endi +print execute sql select tan(11)+c2 from tb1; +sql select tan(11)+c2 from tb1; +if $data00 != @-224.950846454@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-223.950846454@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-221.950846454@ then + return -1 +endi +if $data50 != @-98.950846454@ then + return -1 +endi +if $data60 != @-352.950846454@ then + return -1 +endi +print execute sql select tan(c1)+c2 from tb1; +sql_error select tan(c1)+c2 from tb1; +print execute sql select tan(c2)+11 from tb1; +sql select tan(c2)+11 from tb1; +if $data00 != @12.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @8.814960137@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @12.157821282@ then + return -1 +endi +if $data50 != @15.185891832@ then + return -1 +endi +if $data60 != @6.814108168@ then + return -1 +endi +print execute sql select tan(c1),c1,c2 from tb1; +sql_error select tan(c1),c1,c2 from tb1; +print execute sql select tan(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select tan(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select tan(c1),floor(c3) from tb1; +sql_error select tan(c1),floor(c3) from tb1; +print execute sql select tan(c1),tan(c2+c3) from tb1; +sql_error select tan(c1),tan(c2+c3) from tb1; +print execute sql select tan(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select tan(c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @-2.185039863@ then + return -1 +endi +if $data10 != @-6.799711455@ then + return -1 +endi +if $data20 != @21.780973629@ then + return -1 +endi +if $data30 != @-21.780973629@ then + return -1 +endi +print execute sql select tan(c2) from tb1 order by ts desc; +sql select tan(c2) from tb1 order by ts desc; +if $data00 != @-4.185891832@ then + return -1 +endi +if $data10 != @4.185891832@ then + return -1 +endi +if $data20 != @1.157821282@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @-2.185039863@ then + return -1 +endi +if $data50 != @NULL@ then + return -1 +endi +if $data60 != @1.557407725@ then + return -1 +endi +print execute sql select tan(c2+c3) from tb1 order by ts desc; +sql select tan(c2+c3) from tb1 order by ts desc; +if $data00 != @-21.780973629@ then + return -1 +endi +if $data10 != @21.780973629@ then + return -1 +endi +if $data20 != @-6.799711455@ 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 != @-2.185039863@ then + return -1 +endi +print execute sql select tan(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select tan(c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @-6.799711455@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +print execute sql select tan(c2) from stb1; +sql select tan(c2) from stb1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @4.185891832@ then + return -1 +endi +if $data60 != @-4.185891832@ then + return -1 +endi +if $data70 != @1.557407725@ then + return -1 +endi +if $data80 != @-2.185039863@ then + return -1 +endi +if $data90 != @-0.142546543@ then + return -1 +endi +print execute sql select tan(c2) from stb1 order by ts desc; +sql select tan(c2) from stb1 order by ts desc; +if $data00 != @0.871447983@ then + if $data00 != @-4.185891832@ then + return -1 + endi +endi +if $data20 != @-0.291006191@ then + if $data20 != @4.185891832@ then + return -1 + endi +endi +if $data40 != @-3.380515006@ then + if $data40 != @1.157821282@ then + return -1 + endi +endi +if $data60 != @1.157821282@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data80 != @-0.142546543@ then + if $data80 != @-2.185039863@ then + return -1 + endi +endi +print execute sql select tan(c4),t1 from stb1 order by ts desc; +sql select tan(c4),t1 from stb1 order by ts desc; +if $data00 != @0.871447983@ then + if $data00 != @-1.052377964@ then + return -1 + endi +endi +if $data01 != @2@ then + if $data01 != @1@ then + return -1 + endi +endi +if $data20 != @-0.291006191@ then + if $data20 != @1.052377964@ then + return -1 + endi +endi +if $data21 != @2@ then + if $data21 != @1@ then + return -1 + endi +endi +if $data40 != @-3.380515006@ then + if $data40 != @1.157821282@ then + return -1 + endi +endi +if $data41 != @2@ then + if $data41 != @1@ then + return -1 + endi +endi +if $data60 != @1.157821282@ then + if $data60 != @NULL@ then + return -1 + endi +endi +if $data61 != @2@ then + if $data61 != @1@ then + return -1 + endi +endi +if $data80 != @-2.185039863@ then + if $data80 != @-2.185039863@ then + return -1 + endi +endi +if $data81 != @2@ then + if $data81 != @1@ then + return -1 + endi +endi +print execute sql select tan(c3),tbname from stb1; +sql select tan(c3),tbname from stb1; +if $data00 != @1.557407725@ 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 != @-0.142546543@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @0.190892344@ then + return -1 +endi +if $data51 != @tb1@ then + return -1 +endi +if $data60 != @-0.190892344@ then + return -1 +endi +if $data61 != @tb1@ then + return -1 +endi +if $data70 != @1.557407725@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @-2.185039863@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @-0.142546543@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select tan(c3),tbname from stb1 where t1 > 1; +sql select tan(c3),tbname from stb1 where t1 > 1; +if $data00 != @1.557407725@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @-2.185039863@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @-0.142546543@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @1.157821282@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @-3.380515006@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @-0.291006191@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @0.871447983@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select tan(c8),tan(c9) from tbn; +sql_error select tan(c8),tan(c9) from tbn; +print execute sql select tan(c8),tan(c9) from tbn order by ts desc; +sql_error select tan(c8),tan(c9) from tbn order by ts desc; +print execute sql select tan(tan(c8)) from tbn; +sql_error select tan(tan(c8)) from tbn; +print execute sql select tan(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select tan(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @-2.185039863@ then + return -1 +endi +if $data20 != @-0.747022297@ then + return -1 +endi +if $data30 != @1.157821282@ then + return -1 +endi +if $data40 != @4.637332055@ then + return -1 +endi +if $data50 != @0.581297682@ then + return -1 +endi +if $data60 != @-0.320040389@ then + return -1 +endi +print execute sql select tan(c2) from (select * from stb1); +sql select tan(c2) from (select * from stb1); +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @4.185891832@ then + return -1 +endi +if $data60 != @-4.185891832@ then + return -1 +endi +if $data70 != @1.557407725@ then + return -1 +endi +if $data80 != @-2.185039863@ then + return -1 +endi +if $data90 != @-0.142546543@ then + return -1 +endi +print execute sql select tan(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 select tan(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)); +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @-2.185039863@ then + return -1 +endi +if $data20 != @-0.747022297@ then + return -1 +endi +if $data30 != @1.157821282@ then + return -1 +endi +if $data40 != @4.637332055@ then + return -1 +endi +if $data50 != @0.581297682@ then + return -1 +endi +if $data60 != @-0.320040389@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select tan(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 select tan(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; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @-2.185039863@ then + return -1 +endi +if $data20 != @-0.747022297@ then + return -1 +endi +if $data30 != @1.157821282@ then + return -1 +endi +if $data40 != @4.637332055@ then + return -1 +endi +if $data50 != @0.581297682@ then + return -1 +endi +if $data60 != @-0.320040389@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select tan(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 select tan(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.320040389@ then + return -1 +endi +if $data40 != @0.581297682@ then + return -1 +endi +if $data50 != @4.637332055@ then + return -1 +endi +if $data60 != @1.157821282@ then + return -1 +endi +if $data70 != @-0.747022297@ then + return -1 +endi +if $data80 != @-2.185039863@ then + return -1 +endi +if $data90 != @1.557407725@ then + return -1 +endi +print execute sql select tan(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 select tan(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; +if $data00 != @NULL@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @0.581297682@ then + return -1 +endi +if $data40 != @4.637332055@ then + return -1 +endi +if $data50 != @1.157821282@ then + return -1 +endi +if $data60 != @-0.747022297@ then + return -1 +endi +if $data70 != @-2.185039863@ then + return -1 +endi +if $data80 != @1.557407725@ then + return -1 +endi +if $data90 != @-0.320040389@ then + return -1 +endi +print execute sql select tan(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 select tan(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; +if $data00 != @-0.320040389@ then + return -1 +endi +if $data10 != @1.557407725@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @-0.747022297@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @4.637332055@ then + return -1 +endi +if $data60 != @0.581297682@ then + return -1 +endi +if $data70 != @NULL@ then + return -1 +endi +if $data80 != @NULL@ then + return -1 +endi +if $data90 != @NULL@ then + return -1 +endi +print execute sql select tan(a) from (select tan(c2) as a from tb1); +sql select tan(a) from (select tan(c2) as a from tb1); +if $data00 != @74.685933399@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @1.417928576@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @2.282204450@ then + return -1 +endi +if $data50 != @1.720515194@ then + return -1 +endi +if $data60 != @-1.720515194@ then + return -1 +endi +print execute sql select tan(tb1.c3),tan(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select tan(tb1.c3),tan(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @1.557407725@ then + return -1 +endi +if $data01 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @-2.185039863@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data21 != @-0.142546543@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data31 != @1.157821282@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data41 != @-3.380515006@ then + return -1 +endi +if $data50 != @0.190892344@ then + return -1 +endi +if $data51 != @-0.291006191@ then + return -1 +endi +if $data60 != @-0.190892344@ then + return -1 +endi +if $data61 != @0.871447983@ then + return -1 +endi +print execute sql select tan(c3) from tb1 union all select tan(c3) from tb2; +sql select tan(c3) from tb1 union all select tan(c3) from tb2; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @NULL@ then + return -1 +endi +if $data30 != @-0.142546543@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @0.190892344@ then + return -1 +endi +if $data60 != @-0.190892344@ then + return -1 +endi +if $data70 != @1.557407725@ then + return -1 +endi +if $data80 != @-2.185039863@ then + return -1 +endi +if $data90 != @-0.142546543@ then + return -1 +endi diff --git a/tests/script/general/compute/math_tan2.sim b/tests/script/general/compute/math_tan2.sim new file mode 100644 index 0000000000..23e4803c6d --- /dev/null +++ b/tests/script/general/compute/math_tan2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select tan(stb1.c4),tan(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select tan(stb1.c4),tan(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @1.557407725@ then + return -1 +endi +if $data01 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data11 != @-2.185039863@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data21 != @-0.142546543@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data31 != @1.157821282@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data41 != @-3.380515006@ then + return -1 +endi +if $data50 != @1.052377964@ then + return -1 +endi +if $data51 != @-0.291006191@ then + return -1 +endi +if $data60 != @-1.052377964@ then + return -1 +endi +if $data61 != @0.871447983@ then + return -1 +endi +print execute sql select tan(c4) as a from stb1 union all select tan(c5) as a from stba; +sql select tan(c4) as a from stb1 union all select tan(c5) as a from stba; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @NULL@ then + return -1 +endi +if $data20 != @-2.185039863@ then + return -1 +endi +if $data30 != @NULL@ then + return -1 +endi +if $data40 != @1.157821282@ then + return -1 +endi +if $data50 != @1.052377964@ then + return -1 +endi +if $data60 != @-1.052377964@ then + return -1 +endi +if $data70 != @1.557407725@ then + return -1 +endi +if $data80 != @-2.185039863@ then + return -1 +endi +if $data90 != @-2.185039863@ then + return -1 +endi +print execute sql select tan(c2) from stba; +sql select tan(c2) from stba; +if $data00 != @1.557407725@ then + return -1 +endi +if $data10 != @-2.185039863@ then + return -1 +endi +if $data20 != @-0.142546543@ then + return -1 +endi +if $data30 != @1.157821282@ then + return -1 +endi +if $data40 != @-3.380515006@ then + return -1 +endi +if $data50 != @-0.291006191@ then + return -1 +endi +if $data60 != @0.871447983@ then + return -1 +endi +if $data70 != @-6.799711455@ then + return -1 +endi +if $data80 != @-0.452315659@ then + return -1 +endi +if $data90 != @0.000000000@ then + return -1 +endi +print execute sql select tan(min(c2)) from tba1; +sql select tan(min(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select tan(max(c2)) from tba1; +sql select tan(max(c2)) from tba1; +if $data00 != @-0.452315659@ then + return -1 +endi +print execute sql select tan(count(c2)) from tba1; +sql select tan(count(c2)) from tba1; +if $data00 != @-6.405331197@ then + return -1 +endi +print execute sql select tan(sum(c2)) from tba1; +sql select tan(sum(c2)) from tba1; +if $data00 != @-0.088715757@ then + return -1 +endi +print execute sql select tan(avg(c2)) from tba1; +sql select tan(avg(c2)) from tba1; +if $data00 != @4.637332055@ then + return -1 +endi +print execute sql select tan(percentile(c2, 10)) from tba1; +sql select tan(percentile(c2, 10)) from tba1; +if $data00 != @1.260158218@ then + return -1 +endi +print execute sql select tan(apercentile(c2, 10)) from tba1; +sql select tan(apercentile(c2, 10)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select tan(stddev(c2)) from tba1; +sql select tan(stddev(c2)) from tba1; +if $data00 != @-0.276016859@ then + return -1 +endi +print execute sql select tan(spread(c2)) from tba1; +sql select tan(spread(c2)) from tba1; +if $data00 != @-0.452315659@ then + return -1 +endi +print execute sql select tan(twa(c2)) from tba1; +sql select tan(twa(c2)) from tba1; +if $data00 != @13.405571552@ then + return -1 +endi +print execute sql select tan(leastsquares(c2, 1, 1)) from tba1; +sql_error select tan(leastsquares(c2, 1, 1)) from tba1; +print execute sql select tan(interp(c2)) from tba1 every(1s) +sql select tan(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @1.557407725@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @-2.185039863@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @-0.142546543@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @1.157821282@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @-3.380515006@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @-0.291006191@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @0.871447983@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @-6.799711455@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @-0.452315659@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @0.000000000@ then + return -1 +endi +print execute sql select tan(interp(c2)) from stba every(1s) group by tbname; +sql select tan(interp(c2)) from stba every(1s) group by tbname; +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @1.557407725@ then + return -1 +endi +if $data02 != @tba1@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @-2.185039863@ then + return -1 +endi +if $data12 != @tba1@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @-0.142546543@ then + return -1 +endi +if $data22 != @tba1@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @1.157821282@ then + return -1 +endi +if $data32 != @tba1@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @-3.380515006@ then + return -1 +endi +if $data42 != @tba1@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @-0.291006191@ then + return -1 +endi +if $data52 != @tba1@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @0.871447983@ then + return -1 +endi +if $data62 != @tba1@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @-6.799711455@ then + return -1 +endi +if $data72 != @tba1@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @-0.452315659@ then + return -1 +endi +if $data82 != @tba1@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @0.000000000@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select tan(elapsed(ts)) from tba1; +sql select tan(elapsed(ts)) from tba1; +if $data00 != @-0.041809624@ then + return -1 +endi +print execute sql select tan(rate(c2)) from tba1; +sql select tan(rate(c2)) from tba1; +if $data00 != @1.251272660@ then + return -1 +endi +print execute sql select tan(irate(c2)) from tba1; +sql select tan(irate(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select tan(first(c2)) from tba1; +sql select tan(first(c2)) from tba1; +if $data00 != @1.557407725@ then + return -1 +endi +print execute sql select tan(last(c2)) from tba1; +sql select tan(last(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select tan(last_row(c2)) from tba1; +sql select tan(last_row(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select tan(top(c2, 1)) from tba1; +sql_error select tan(top(c2, 1)) from tba1; +print execute sql select tan(bottom(c2, 1)) from tba1; +sql_error select tan(bottom(c2, 1)) from tba1; +print execute sql select tan(leastsquares(c2, 1, 1)) from tba1; +sql_error select tan(leastsquares(c2, 1, 1)) from tba1; +print execute sql select tan(derivative(c2, 1s, 0)) from tba1; +sql_error select tan(derivative(c2, 1s, 0)) from tba1; +print execute sql select tan(diff(c2)) from tba1; +sql_error select tan(diff(c2)) from tba1; +print execute sql select tan(csum(c2)) from tba1; +sql_error select tan(csum(c2)) from tba1; +print execute sql select tan(mavg(c2,2)) from tba1; +sql_error select tan(mavg(c2,2)) from tba1; +print execute sql select tan(sample(c2,2)) from tba1; +sql_error select tan(sample(c2,2)) from tba1; +print execute sql select tan(_block_dist()) from tba1; +sql_error select tan(_block_dist()) from tba1; -- GitLab