diff --git a/tests/script/general/compute/math_asin.sim b/tests/script/general/compute/math_asin.sim new file mode 100644 index 0000000000000000000000000000000000000000..dee8bffaf35135fca1d31878dabc25efd2a3146a --- /dev/null +++ b/tests/script/general/compute/math_asin.sim @@ -0,0 +1,1073 @@ +sleep 100 +sql connect +sql use db + +print execute sql select asin(*) from tb1; +sql_error select asin(*) from tb1; +print execute sql select asin(*) from tb1; +sql_error select asin(*) from tb1; +print execute sql select asin(*) from tb1; +sql_error select asin(*) from tb1; +print execute sql select asin(*) from tb1; +sql_error select asin(*) from tb1; +print execute sql select asin(*) as a from tb1; +sql_error select asin(*) as a from tb1; +print execute sql select asin(*) + 1 as a from tb1; +sql_error select asin(*) + 1 as a from tb1; +print execute sql select asin(tb1.*) + 1 as a from tb1; +sql_error select asin(tb1.*) + 1 as a from tb1; +print execute sql select asin(*) from tb1; +sql_error select asin(*) from tb1; +print execute sql select asin(c1) from tb1; +sql_error select asin(c1) from tb1; +print execute sql select asin(c1) from tb1; +sql_error select asin(c1) from tb1; +print execute sql select asin(c1 + c2) from tb1; +sql_error select asin(c1 + c2) from tb1; +print execute sql select asin(13) from tb1; +sql select asin(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 asin(c1) from tb1; +sql_error select asin(c1) from tb1; +print execute sql select asin(c2) from tb1; +sql select asin(c2) 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 asin(c3) from tb1; +sql select asin(c3) from tb1; +if $data00 != @1.570796327@ 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 asin(c4) from tb1; +sql select asin(c4) 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 asin(c5) from tb1; +sql select asin(c5) from tb1; +if $data00 != @1.570796327@ 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 asin(c6) from tb1; +sql select asin(c6) 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 asin(c7) from tb1; +sql select asin(c7) from tb1; +if $data00 != @1.570796327@ 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 asin(c8) from tb1; +sql_error select asin(c8) from tb1; +print execute sql select asin(c9) from tb1; +sql_error select asin(c9) from tb1; +print execute sql select asin(c10) from tb1; +sql select asin(c10) 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 != @0.000000000@ then + return -1 +endi +print execute sql select asin(c11) from tb1; +sql select asin(c11) from tb1; +if $data00 != @1.570796327@ 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 != @0.000000000@ then + return -1 +endi +print execute sql select asin(c12) from tb1; +sql select asin(c12) 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 != @0.000000000@ then + return -1 +endi +print execute sql select asin(c13) from tb1; +sql select asin(c13) from tb1; +if $data00 != @1.570796327@ 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 != @0.000000000@ then + return -1 +endi +print execute sql select asin(12345678900000000000000000) from tb1; +sql_error select asin(12345678900000000000000000) from tb1; +print execute sql select distinct asin(123) from tb1; +sql_error select distinct asin(123) from tb1; +print execute sql select asin(t1) from stb1; +sql_error select asin(t1) from stb1; +print execute sql select asin(c1),avg(c3) from tb1; +sql_error select asin(c1),avg(c3) from tb1; +print execute sql select asin(c1),top(c3,1) from tb1; +sql_error select asin(c1),top(c3,1) from tb1; +print execute sql select asin(c2+c3) from tb1 session(ts, 1s); +sql_error select asin(c2+c3) from tb1 session(ts, 1s); +print execute sql select asin(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select asin(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select asin(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select asin(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select asin(c2+c3) from stb1 group by t1; +sql_error select asin(c2+c3) from stb1 group by t1; +print execute sql select asin(c2+c3) from stb1 group by ts; +sql_error select asin(c2+c3) from stb1 group by ts; +print execute sql select asin(c2+c3) from stb1 group by c1; +sql_error select asin(c2+c3) from stb1 group by c1; +print execute sql select asin(c2+c3) from stb1 group by tbname; +sql_error select asin(c2+c3) from stb1 group by tbname; +print execute sql select asin(c2+c3) from tb1 order by c2; +sql_error select asin(c2+c3) from tb1 order by c2; +print execute sql select asin(c8),asin(c9) from tbn; +sql_error select asin(c8),asin(c9) from tbn; +print execute sql select asin(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select asin(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select asin(a) from (select asin(c2) as a from tb1); +sql select asin(a) from (select asin(c2) as a 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 asin("abc") from tb1; +sql_error select asin("abc") from tb1; +print execute sql select asin(c2 + c3) from tb1; +sql select asin(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 asin((c2 + c3)) from tb1; +sql select asin((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 asin((c2 * c3)+c4-6) from tb1; +sql select asin((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 asin(11)+c2 from tb1; +sql select asin(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 asin(c1)+c2 from tb1; +sql_error select asin(c1)+c2 from tb1; +print execute sql select asin(c2)+11 from tb1; +sql select asin(c2)+11 from tb1; +if $data00 != @12.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 asin(c1),c1,c2 from tb1; +sql_error select asin(c1),c1,c2 from tb1; +print execute sql select asin(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select asin(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select asin(c1),floor(c3) from tb1; +sql_error select asin(c1),floor(c3) from tb1; +print execute sql select asin(c1),asin(c2+c3) from tb1; +sql_error select asin(c1),asin(c2+c3) from tb1; +print execute sql select asin(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select asin(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 asin(c2) from tb1 order by ts desc; +sql select asin(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 != @1.570796327@ then + return -1 +endi +print execute sql select asin(c2+c3) from tb1 order by ts desc; +sql select asin(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 asin(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select asin(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 asin(c2) from stb1; +sql select asin(c2) from stb1; +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 +if $data70 != @1.570796327@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select asin(c2) from stb1 order by ts desc; +sql select asin(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 != @NULL@ then + if $data60 != @nan@ then + return -1 + endi +endi +if $data80 != @nan@ then + if $data80 != @nan@ then + return -1 + endi +endi +print execute sql select asin(c4),t1 from stb1 order by ts desc; +sql select asin(c4),t1 from stb1 order by ts desc; +if $data00 != @nan@ then + if $data00 != @nan@ then + return -1 + endi +endi +if $data01 != @1@ then + if $data01 != @2@ then + return -1 + endi +endi +if $data20 != @nan@ then + if $data20 != @nan@ then + return -1 + endi +endi +if $data21 != @1@ then + if $data21 != @2@ then + return -1 + endi +endi +if $data40 != @nan@ then + if $data40 != @nan@ then + return -1 + endi +endi +if $data41 != @1@ then + if $data41 != @2@ then + return -1 + endi +endi +if $data60 != @NULL@ then + if $data60 != @nan@ then + return -1 + endi +endi +if $data61 != @1@ then + if $data61 != @2@ then + return -1 + endi +endi +if $data80 != @nan@ then + if $data80 != @nan@ then + return -1 + endi +endi +if $data81 != @1@ then + if $data81 != @2@ then + return -1 + endi +endi +print execute sql select asin(c3),tbname from stb1; +sql select asin(c3),tbname from stb1; +if $data00 != @1.570796327@ 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 != @1.570796327@ 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 asin(c3),tbname from stb1 where t1 > 1; +sql select asin(c3),tbname from stb1 where t1 > 1; +if $data00 != @1.570796327@ 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 asin(c8),asin(c9) from tbn; +sql_error select asin(c8),asin(c9) from tbn; +print execute sql select asin(c8),asin(c9) from tbn order by ts desc; +sql_error select asin(c8),asin(c9) from tbn order by ts desc; +print execute sql select asin(asin(c8)) from tbn; +sql_error select asin(asin(c8)) from tbn; +print execute sql select asin(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select asin(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @1.570796327@ 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 asin(c2) from (select * from stb1); +sql select asin(c2) from (select * from stb1); +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 +if $data70 != @1.570796327@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select asin(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 asin(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.570796327@ 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 asin(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 asin(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.570796327@ 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 asin(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 asin(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 != @1.570796327@ then + return -1 +endi +print execute sql select asin(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 asin(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 != @1.570796327@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select asin(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 asin(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 != @1.570796327@ 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 asin(a) from (select asin(c2) as a from tb1); +sql select asin(a) from (select asin(c2) as a 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 asin(tb1.c3),asin(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select asin(tb1.c3),asin(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @1.570796327@ then + return -1 +endi +if $data01 != @1.570796327@ 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 asin(c3) from tb1 union all select asin(c3) from tb2; +sql select asin(c3) from tb1 union all select asin(c3) from tb2; +if $data00 != @1.570796327@ 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 != @1.570796327@ 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_asin2.sim b/tests/script/general/compute/math_asin2.sim new file mode 100644 index 0000000000000000000000000000000000000000..98b4eb05bcb24b9fb962dbbdd6e8ddfa3e55280f --- /dev/null +++ b/tests/script/general/compute/math_asin2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select asin(stb1.c4),asin(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select asin(stb1.c4),asin(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @1.570796327@ then + return -1 +endi +if $data01 != @1.570796327@ 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 asin(c4) as a from stb1 union all select asin(c5) as a from stba; +sql select asin(c4) as a from stb1 union all select asin(c5) as a from stba; +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 +if $data70 != @1.570796327@ then + return -1 +endi +if $data80 != @nan@ then + return -1 +endi +if $data90 != @nan@ then + return -1 +endi +print execute sql select asin(c2) from stba; +sql select asin(c2) from stba; +if $data00 != @1.570796327@ 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 != @0.000000000@ then + return -1 +endi +print execute sql select asin(min(c2)) from tba1; +sql select asin(min(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select asin(max(c2)) from tba1; +sql select asin(max(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(count(c2)) from tba1; +sql select asin(count(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(sum(c2)) from tba1; +sql select asin(sum(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(avg(c2)) from tba1; +sql select asin(avg(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(percentile(c2, 10)) from tba1; +sql select asin(percentile(c2, 10)) from tba1; +if $data00 != @1.119769515@ then + return -1 +endi +print execute sql select asin(apercentile(c2, 10)) from tba1; +sql select asin(apercentile(c2, 10)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select asin(stddev(c2)) from tba1; +sql select asin(stddev(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(spread(c2)) from tba1; +sql select asin(spread(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(twa(c2)) from tba1; +sql select asin(twa(c2)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(leastsquares(c2, 1, 1)) from tba1; +sql_error select asin(leastsquares(c2, 1, 1)) from tba1; +print execute sql select asin(interp(c2)) from tba1 every(1s) +sql select asin(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @1.570796327@ 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 != @0.000000000@ then + return -1 +endi +print execute sql select asin(interp(c2)) from stba every(1s) group by tbname; +sql select asin(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.570796327@ 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 != @0.000000000@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select asin(elapsed(ts)) from tba1; +sql select asin(elapsed(ts)) from tba1; +if $data00 != @nan@ then + return -1 +endi +print execute sql select asin(rate(c2)) from tba1; +sql select asin(rate(c2)) from tba1; +if $data00 != @1.111922122@ then + return -1 +endi +print execute sql select asin(irate(c2)) from tba1; +sql select asin(irate(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select asin(first(c2)) from tba1; +sql select asin(first(c2)) from tba1; +if $data00 != @1.570796327@ then + return -1 +endi +print execute sql select asin(last(c2)) from tba1; +sql select asin(last(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select asin(last_row(c2)) from tba1; +sql select asin(last_row(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select asin(top(c2, 1)) from tba1; +sql_error select asin(top(c2, 1)) from tba1; +print execute sql select asin(bottom(c2, 1)) from tba1; +sql_error select asin(bottom(c2, 1)) from tba1; +print execute sql select asin(leastsquares(c2, 1, 1)) from tba1; +sql_error select asin(leastsquares(c2, 1, 1)) from tba1; +print execute sql select asin(derivative(c2, 1s, 0)) from tba1; +sql_error select asin(derivative(c2, 1s, 0)) from tba1; +print execute sql select asin(diff(c2)) from tba1; +sql_error select asin(diff(c2)) from tba1; +print execute sql select asin(csum(c2)) from tba1; +sql_error select asin(csum(c2)) from tba1; +print execute sql select asin(mavg(c2,2)) from tba1; +sql_error select asin(mavg(c2,2)) from tba1; +print execute sql select asin(sample(c2,2)) from tba1; +sql_error select asin(sample(c2,2)) from tba1; +print execute sql select asin(_block_dist()) from tba1; +sql_error select asin(_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 56527d266874238675c1f45c1e681b40918389c5..71fc05859e428c3ade95ff04c1d0b577463a94e6 100644 --- a/tests/script/general/compute/math_str_func.sim +++ b/tests/script/general/compute/math_str_func.sim @@ -47,6 +47,7 @@ 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 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); @@ -102,6 +103,8 @@ run general/compute/math_sqrt.sim run general/compute/math_sqrt2.sim run general/compute/math_abs.sim run general/compute/math_abs2.sim +run general/compute/math_asin.sim +run general/compute/math_asin2.sim #system sh/exec.sh -n dnode1 -s stop -x SIGINT