diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index 90b42cc6574d116c18fc46c201b6de9dc95fc989..4c61cbb0f730780c6c7106a02c765974b2d21706 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -567,6 +567,10 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { } else if (pQueryAttr->pointInterpQuery) { op = OP_TimeEvery; taosArrayPush(plan, &op); + if (pQueryAttr->pExpr2 != NULL) { + op = OP_Project; + taosArrayPush(plan, &op); + } } else if (pQueryAttr->interval.interval > 0) { if (pQueryAttr->stableQuery) { op = OP_MultiTableTimeInterval; diff --git a/tests/script/general/compute/math_abs.sim b/tests/script/general/compute/math_abs.sim new file mode 100644 index 0000000000000000000000000000000000000000..dfa073e9c5f9505330f26eb52a097136d6154e60 --- /dev/null +++ b/tests/script/general/compute/math_abs.sim @@ -0,0 +1,1068 @@ +sleep 100 +sql connect +sql use db + +print execute sql select abs(*) from tb1; +sql_error select abs(*) from tb1; +print execute sql select abs(*) from tb1; +sql_error select abs(*) from tb1; +print execute sql select abs(*) from tb1; +sql_error select abs(*) from tb1; +print execute sql select abs(*) from tb1; +sql_error select abs(*) from tb1; +print execute sql select abs(*) as a from tb1; +sql_error select abs(*) as a from tb1; +print execute sql select abs(*) + 1 as a from tb1; +sql_error select abs(*) + 1 as a from tb1; +print execute sql select abs(tb1.*) + 1 as a from tb1; +sql_error select abs(tb1.*) + 1 as a from tb1; +print execute sql select abs(*) from tb1; +sql_error select abs(*) from tb1; +print execute sql select abs(c1) from tb1; +sql_error select abs(c1) from tb1; +print execute sql select abs(c1) from tb1; +sql_error select abs(c1) from tb1; +print execute sql select abs(c1 + c2) from tb1; +sql_error select abs(c1 + c2) from tb1; +print execute sql select abs(13) from tb1; +sql select abs(13) from tb1; +if $data00 != @13@ then + return -1 +endi +if $data10 != @13@ then + return -1 +endi +if $data20 != @13@ then + return -1 +endi +if $data30 != @13@ then + return -1 +endi +if $data40 != @13@ then + return -1 +endi +if $data50 != @13@ then + return -1 +endi +if $data60 != @13@ then + return -1 +endi +print execute sql select abs(c1) from tb1; +sql_error select abs(c1) from tb1; +print execute sql select abs(c2) from tb1; +sql select abs(c2) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @127@ then + return -1 +endi +if $data60 != @127@ then + return -1 +endi +print execute sql select abs(c3) from tb1; +sql select abs(c3) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != @3@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @32767@ then + return -1 +endi +if $data60 != @32767@ then + return -1 +endi +print execute sql select abs(c4) from tb1; +sql select abs(c4) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @2147483647@ then + return -1 +endi +if $data60 != @2147483647@ then + return -1 +endi +print execute sql select abs(c5) from tb1; +sql select abs(c5) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != @3@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @9223372036854775807@ then + return -1 +endi +if $data60 != @9223372036854775807@ then + return -1 +endi +print execute sql select abs(c6) from tb1; +sql select abs(c6) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2.000000000@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4.000000000@ then + return -1 +endi +if $data50 != @340282346638528859811704183484516925440.000000000@ then + return -1 +endi +if $data60 != @340282346638528859811704183484516925440.000000000@ then + return -1 +endi +print execute sql select abs(c7) from tb1; +sql select abs(c7) from tb1; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != @3.000000000@ then + return -1 +endi +if $data40 != @4.000000000@ then + return -1 +endi +if $data50 != @179769000000000006323030492138942643493033036433685336215410983289126434148906289940615299632196609445533816320312774433484859900046491141051651091672734470972759941382582304802812882753059262973637182942535982636884444611376868582636745405553206881859340916340092953230149901406738427651121855107737424232448.000000000@ then + return -1 +endi +if $data60 != @179769000000000006323030492138942643493033036433685336215410983289126434148906289940615299632196609445533816320312774433484859900046491141051651091672734470972759941382582304802812882753059262973637182942535982636884444611376868582636745405553206881859340916340092953230149901406738427651121855107737424232448.000000000@ then + return -1 +endi +print execute sql select abs(c8) from tb1; +sql_error select abs(c8) from tb1; +print execute sql select abs(c9) from tb1; +sql_error select abs(c9) from tb1; +print execute sql select abs(c10) from tb1; +sql select abs(c10) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @254@ then + return -1 +endi +if $data60 != @0@ then + return -1 +endi +print execute sql select abs(c11) from tb1; +sql select abs(c11) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != @3@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @65534@ then + return -1 +endi +if $data60 != @0@ then + return -1 +endi +print execute sql select abs(c12) from tb1; +sql select abs(c12) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @4294967294@ then + return -1 +endi +if $data60 != @0@ then + return -1 +endi +print execute sql select abs(c13) from tb1; +sql select abs(c13) from tb1; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != @3@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @9223372036854775807@ then + return -1 +endi +if $data60 != @0@ then + return -1 +endi +print execute sql select abs(12345678900000000000000000) from tb1; +sql_error select abs(12345678900000000000000000) from tb1; +print execute sql select distinct abs(123) from tb1; +sql_error select distinct abs(123) from tb1; +print execute sql select abs(t1) from stb1; +sql_error select abs(t1) from stb1; +print execute sql select abs(c1),avg(c3) from tb1; +sql_error select abs(c1),avg(c3) from tb1; +print execute sql select abs(c1),top(c3,1) from tb1; +sql_error select abs(c1),top(c3,1) from tb1; +print execute sql select abs(c2+c3) from tb1 session(ts, 1s); +sql_error select abs(c2+c3) from tb1 session(ts, 1s); +print execute sql select abs(c2+c3) from tb1 STATE_WINDOW(c1); +sql_error select abs(c2+c3) from tb1 STATE_WINDOW(c1); +print execute sql select abs(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +sql_error select abs(c2+c3) from tb1 interval(1s) sliding(1s) fill(NULL); +print execute sql select abs(c2+c3) from stb1 group by t1; +sql_error select abs(c2+c3) from stb1 group by t1; +print execute sql select abs(c2+c3) from stb1 group by ts; +sql_error select abs(c2+c3) from stb1 group by ts; +print execute sql select abs(c2+c3) from stb1 group by c1; +sql_error select abs(c2+c3) from stb1 group by c1; +print execute sql select abs(c2+c3) from stb1 group by tbname; +sql_error select abs(c2+c3) from stb1 group by tbname; +print execute sql select abs(c2+c3) from tb1 order by c2; +sql_error select abs(c2+c3) from tb1 order by c2; +print execute sql select abs(c8),abs(c9) from tbn; +sql_error select abs(c8),abs(c9) from tbn; +print execute sql select abs(ts) from (select avg(c2) as a from stb1 interval(1s)); +sql_error select abs(ts) from (select avg(c2) as a from stb1 interval(1s)); +print execute sql select abs(a) from (select abs(c2) as a from tb1); +sql select abs(a) from (select abs(c2) as a from tb1); +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @127@ then + return -1 +endi +if $data60 != @127@ then + return -1 +endi +print execute sql select abs("abc") from tb1; +sql_error select abs("abc") from tb1; +print execute sql select abs(c2 + c3) from tb1; +sql select abs(c2 + c3) from tb1; +if $data00 != @2.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @8.000000000@ then + return -1 +endi +if $data50 != @32894.000000000@ then + return -1 +endi +if $data60 != @32894.000000000@ then + return -1 +endi +print execute sql select abs((c2 + c3)) from tb1; +sql select abs((c2 + c3)) from tb1; +if $data00 != @2.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @8.000000000@ then + return -1 +endi +if $data50 != @32894.000000000@ then + return -1 +endi +if $data60 != @32894.000000000@ then + return -1 +endi +print execute sql select abs((c2 * c3)+c4-6) from tb1; +sql select abs((c2 * c3)+c4-6) from tb1; +if $data00 != @4.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @14.000000000@ then + return -1 +endi +if $data50 != @2151645050.000000000@ then + return -1 +endi +if $data60 != @2143322244.000000000@ then + return -1 +endi +print execute sql select abs(11)+c2 from tb1; +sql select abs(11)+c2 from tb1; +if $data00 != @12.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @13.000000000@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @15.000000000@ then + return -1 +endi +if $data50 != @138.000000000@ then + return -1 +endi +if $data60 != @-116.000000000@ then + return -1 +endi +print execute sql select abs(c1)+c2 from tb1; +sql_error select abs(c1)+c2 from tb1; +print execute sql select abs(c2)+11 from tb1; +sql select abs(c2)+11 from tb1; +if $data00 != @12.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @13.000000000@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @15.000000000@ then + return -1 +endi +if $data50 != @138.000000000@ then + return -1 +endi +if $data60 != @138.000000000@ then + return -1 +endi +print execute sql select abs(c1),c1,c2 from tb1; +sql_error select abs(c1),c1,c2 from tb1; +print execute sql select abs(c1),t1,ts,tbname,_C0,_c0 from tb1; +sql_error select abs(c1),t1,ts,tbname,_C0,_c0 from tb1; +print execute sql select abs(c1),floor(c3) from tb1; +sql_error select abs(c1),floor(c3) from tb1; +print execute sql select abs(c1),abs(c2+c3) from tb1; +sql_error select abs(c1),abs(c2+c3) from tb1; +print execute sql select abs(c2+c3) from tb1 where c2 is not null and c3 is not null; +sql select abs(c2+c3) from tb1 where c2 is not null and c3 is not null; +if $data00 != @2.000000000@ then + return -1 +endi +if $data10 != @8.000000000@ then + return -1 +endi +if $data20 != @32894.000000000@ then + return -1 +endi +if $data30 != @32894.000000000@ then + return -1 +endi +print execute sql select abs(c2) from tb1 order by ts desc; +sql select abs(c2) from tb1 order by ts desc; +if $data00 != @127@ then + return -1 +endi +if $data10 != @127@ then + return -1 +endi +if $data20 != @4@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @2@ then + return -1 +endi +if $data50 != NULL then + return -1 +endi +if $data60 != @1@ then + return -1 +endi +print execute sql select abs(c2+c3) from tb1 order by ts desc; +sql select abs(c2+c3) from tb1 order by ts desc; +if $data00 != @32894.000000000@ then + return -1 +endi +if $data10 != @32894.000000000@ then + return -1 +endi +if $data20 != @8.000000000@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != NULL then + return -1 +endi +if $data50 != NULL then + return -1 +endi +if $data60 != @2.000000000@ then + return -1 +endi +print execute sql select abs(c2+c3) from tb1 order by ts desc limit 3 offset 2; +sql select abs(c2+c3) from tb1 order by ts desc limit 3 offset 2; +if $data00 != @8.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +print execute sql select abs(c2) from stb1; +sql select abs(c2) from stb1; +if $data00 != @1@ then +if $data10 != NULL then + return -1 +endi +endi +if $data20 != @2@ then +if $data30 != NULL then + return -1 +endi +endi +if $data40 != @4@ then +if $data50 != @127@ then + return -1 +endi +endi +if $data60 != @127@ then +if $data70 != @1@ then + return -1 +endi +endi +if $data80 != @2@ then +if $data90 != @3@ then + return -1 +endi +endi +print execute sql select abs(c2) from stb1 order by ts desc; +sql select abs(c2) from stb1 order by ts desc; +if $data00 != @7@ then +if $data00 != @127@ then + return -1 +endi +endi +if $data20 != @6@ then +if $data20 != @127@ then + return -1 +endi +endi +if $data40 != @5@ then +if $data40 != @4@ then + return -1 +endi +endi +if $data60 != @4@ then +if $data60 != NULL then + return -1 +endi +endi +if $data80 != @3@ then +if $data80 != @2@ then + return -1 +endi +endi +print execute sql select abs(c4),t1 from stb1 order by ts desc; +sql select abs(c4),t1 from stb1 order by ts desc; +if $data00 != @7@ then +if $data00 != @2147483647@ then + return -1 +endi +endi +if $data01 != @2@ then +if $data01 != @1@ then + return -1 +endi +endi +if $data20 != @6@ then +if $data20 != @2147483647@ then + return -1 +endi +endi +if $data21 != @2@ then +if $data21 != @1@ then + return -1 +endi +endi +if $data40 != @5@ then +if $data40 != @4@ then + return -1 +endi +endi +if $data41 != @2@ then +if $data41 != @1@ then + return -1 +endi +endi +if $data60 != @4@ then +if $data60 != NULL then + return -1 +endi +endi +if $data61 != @2@ then +if $data61 != @1@ then + return -1 +endi +endi +if $data80 != @2@ then +if $data80 != @2@ then + return -1 +endi +endi +if $data81 != @2@ then +if $data81 != @1@ then + return -1 +endi +endi +print execute sql select abs(c3),tbname from stb1; +sql select abs(c3),tbname from stb1; +if $data00 != @1@ 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 != @3@ then + return -1 +endi +if $data31 != @tb1@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data41 != @tb1@ then + return -1 +endi +if $data50 != @32767@ then + return -1 +endi +if $data51 != @tb1@ then + return -1 +endi +if $data60 != @32767@ then + return -1 +endi +if $data61 != @tb1@ then + return -1 +endi +if $data70 != @1@ then + return -1 +endi +if $data71 != @tb2@ then + return -1 +endi +if $data80 != @2@ then + return -1 +endi +if $data81 != @tb2@ then + return -1 +endi +if $data90 != @3@ then + return -1 +endi +if $data91 != @tb2@ then + return -1 +endi +print execute sql select abs(c3),tbname from stb1 where t1 > 1; +sql select abs(c3),tbname from stb1 where t1 > 1; +if $data00 != @1@ then + return -1 +endi +if $data01 != @tb2@ then + return -1 +endi +if $data10 != @2@ then + return -1 +endi +if $data11 != @tb2@ then + return -1 +endi +if $data20 != @3@ then + return -1 +endi +if $data21 != @tb2@ then + return -1 +endi +if $data30 != @4@ then + return -1 +endi +if $data31 != @tb2@ then + return -1 +endi +if $data40 != @5@ then + return -1 +endi +if $data41 != @tb2@ then + return -1 +endi +if $data50 != @6@ then + return -1 +endi +if $data51 != @tb2@ then + return -1 +endi +if $data60 != @7@ then + return -1 +endi +if $data61 != @tb2@ then + return -1 +endi +print execute sql select abs(c8),abs(c9) from tbn; +sql_error select abs(c8),abs(c9) from tbn; +print execute sql select abs(c8),abs(c9) from tbn order by ts desc; +sql_error select abs(c8),abs(c9) from tbn order by ts desc; +print execute sql select abs(abs(c8)) from tbn; +sql_error select abs(abs(c8)) from tbn; +print execute sql select abs(a) from (select avg(c2) as a from stb1 interval(1s)); +sql select abs(a) from (select avg(c2) as a from stb1 interval(1s)); +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @2.000000000@ then + return -1 +endi +if $data20 != @2.500000000@ then + return -1 +endi +if $data30 != @4.000000000@ then + return -1 +endi +if $data40 != @4.500000000@ then + return -1 +endi +if $data50 != @66.500000000@ then + return -1 +endi +if $data60 != @60.000000000@ then + return -1 +endi +print execute sql select abs(c2) from (select * from stb1); +sql select abs(c2) from (select * from stb1); +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @127@ then + return -1 +endi +if $data60 != @127@ then + return -1 +endi +if $data70 != @1@ then + return -1 +endi +if $data80 != @2@ then + return -1 +endi +if $data90 != @3@ then + return -1 +endi +print execute sql select abs(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 abs(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.000000000@ then + return -1 +endi +if $data10 != @2.000000000@ then + return -1 +endi +if $data20 != @2.500000000@ then + return -1 +endi +if $data30 != @4.000000000@ then + return -1 +endi +if $data40 != @4.500000000@ then + return -1 +endi +if $data50 != @66.500000000@ then + return -1 +endi +if $data60 != @60.000000000@ 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 abs(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 abs(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.000000000@ then + return -1 +endi +if $data10 != @2.000000000@ then + return -1 +endi +if $data20 != @2.500000000@ then + return -1 +endi +if $data30 != @4.000000000@ then + return -1 +endi +if $data40 != @4.500000000@ then + return -1 +endi +if $data50 != @66.500000000@ then + return -1 +endi +if $data60 != @60.000000000@ 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 abs(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 abs(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 != @60.000000000@ then + return -1 +endi +if $data40 != @66.500000000@ then + return -1 +endi +if $data50 != @4.500000000@ then + return -1 +endi +if $data60 != @4.000000000@ then + return -1 +endi +if $data70 != @2.500000000@ then + return -1 +endi +if $data80 != @2.000000000@ then + return -1 +endi +if $data90 != @1.000000000@ then + return -1 +endi +print execute sql select abs(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 abs(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 != @66.500000000@ then + return -1 +endi +if $data40 != @4.500000000@ then + return -1 +endi +if $data50 != @4.000000000@ then + return -1 +endi +if $data60 != @2.500000000@ then + return -1 +endi +if $data70 != @2.000000000@ then + return -1 +endi +if $data80 != @1.000000000@ then + return -1 +endi +if $data90 != @60.000000000@ then + return -1 +endi +print execute sql select abs(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 abs(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 != @60.000000000@ then + return -1 +endi +if $data10 != @1.000000000@ then + return -1 +endi +if $data20 != @2.000000000@ then + return -1 +endi +if $data30 != @2.500000000@ then + return -1 +endi +if $data40 != @4.000000000@ then + return -1 +endi +if $data50 != @4.500000000@ then + return -1 +endi +if $data60 != @66.500000000@ 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 abs(a) from (select abs(c2) as a from tb1); +sql select abs(a) from (select abs(c2) as a from tb1); +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @127@ then + return -1 +endi +if $data60 != @127@ then + return -1 +endi +print execute sql select abs(tb1.c3),abs(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +sql select abs(tb1.c3),abs(tb2.c3) from tb1,tb2 where tb1.ts=tb2.ts; +if $data00 != @1@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data21 != @3@ then + return -1 +endi +if $data30 != @3@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data41 != @5@ then + return -1 +endi +if $data50 != @32767@ then + return -1 +endi +if $data51 != @6@ then + return -1 +endi +if $data60 != @32767@ then + return -1 +endi +if $data61 != @7@ then + return -1 +endi +print execute sql select abs(c3) from tb1 union all select abs(c3) from tb2; +sql select abs(c3) from tb1 union all select abs(c3) from tb2; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != @3@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @32767@ then + return -1 +endi +if $data60 != @32767@ then + return -1 +endi +if $data70 != @1@ then + return -1 +endi +if $data80 != @2@ then + return -1 +endi +if $data90 != @3@ then + return -1 +endi diff --git a/tests/script/general/compute/math_abs2.sim b/tests/script/general/compute/math_abs2.sim new file mode 100644 index 0000000000000000000000000000000000000000..cd419bffcf960e637b370988c71dfe98e002d093 --- /dev/null +++ b/tests/script/general/compute/math_abs2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db + +print execute sql select abs(stb1.c4),abs(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select abs(stb1.c4),abs(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @1@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data21 != @3@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data41 != @5@ then + return -1 +endi +if $data50 != @2147483647@ then + return -1 +endi +if $data51 != @6@ then + return -1 +endi +if $data60 != @2147483647@ then + return -1 +endi +if $data61 != @7@ then + return -1 +endi +print execute sql select abs(c4) as a from stb1 union all select abs(c5) as a from stba; +sql select abs(c4) as a from stb1 union all select abs(c5) as a from stba; +if $data00 != @1@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @2@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @4@ then + return -1 +endi +if $data50 != @2147483647@ then + return -1 +endi +if $data60 != @2147483647@ then + return -1 +endi +if $data70 != @1@ then + return -1 +endi +if $data80 != @2@ then + return -1 +endi +if $data90 != @2@ then + return -1 +endi +print execute sql select abs(c2) from stba; +sql select abs(c2) from stba; +if $data00 != @1@ then + return -1 +endi +if $data10 != @2@ then + return -1 +endi +if $data20 != @3@ then + return -1 +endi +if $data30 != @4@ then + return -1 +endi +if $data40 != @5@ then + return -1 +endi +if $data50 != @6@ then + return -1 +endi +if $data60 != @7@ then + return -1 +endi +if $data70 != @8@ then + return -1 +endi +if $data80 != @9@ then + return -1 +endi +if $data90 != @0@ then + return -1 +endi +print execute sql select abs(min(c2)) from tba1; +sql select abs(min(c2)) from tba1; +if $data00 != @0@ then + return -1 +endi +print execute sql select abs(max(c2)) from tba1; +sql select abs(max(c2)) from tba1; +if $data00 != @9@ then + return -1 +endi +print execute sql select abs(count(c2)) from tba1; +sql select abs(count(c2)) from tba1; +if $data00 != @30@ then + return -1 +endi +print execute sql select abs(sum(c2)) from tba1; +sql select abs(sum(c2)) from tba1; +if $data00 != @135@ then + return -1 +endi +print execute sql select abs(avg(c2)) from tba1; +sql select abs(avg(c2)) from tba1; +if $data00 != @4.500000000@ then + return -1 +endi +print execute sql select abs(percentile(c2, 10)) from tba1; +sql select abs(percentile(c2, 10)) from tba1; +if $data00 != @0.900000000@ then + return -1 +endi +print execute sql select abs(apercentile(c2, 10)) from tba1; +sql select abs(apercentile(c2, 10)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select abs(stddev(c2)) from tba1; +sql select abs(stddev(c2)) from tba1; +if $data00 != @2.872281323@ then + return -1 +endi +print execute sql select abs(spread(c2)) from tba1; +sql select abs(spread(c2)) from tba1; +if $data00 != @9.000000000@ then + return -1 +endi +print execute sql select abs(twa(c2)) from tba1; +sql select abs(twa(c2)) from tba1; +if $data00 != @4.637931034@ then + return -1 +endi +print execute sql select abs(leastsquares(c2, 1, 1)) from tba1; +sql_error select abs(leastsquares(c2, 1, 1)) from tba1; +print execute sql select abs(interp(c2)) from tba1 every(1s) +sql select abs(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @3@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @5@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @6@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @7@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @8@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @9@ then + return -1 +endi +if $data90 != @21-11-11 09:00:09.000@ then + return -1 +endi +if $data91 != @0@ then + return -1 +endi +print execute sql select abs(interp(c2)) from stba every(1s) group by tbname; +sql select abs(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@ 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@ 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 != @3@ 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 != @4@ 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 != @5@ 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 != @6@ 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 != @7@ 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 != @8@ 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 != @9@ 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@ then + return -1 +endi +if $data92 != @tba1@ then + return -1 +endi +print execute sql select abs(elapsed(ts)) from tba1; +sql select abs(elapsed(ts)) from tba1; +if $data00 != @29000.000000000@ then + return -1 +endi +print execute sql select abs(rate(c2)) from tba1; +sql select abs(rate(c2)) from tba1; +if $data00 != @0.896551724@ then + return -1 +endi +print execute sql select abs(irate(c2)) from tba1; +sql select abs(irate(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select abs(first(c2)) from tba1; +sql select abs(first(c2)) from tba1; +if $data00 != @1@ then + return -1 +endi +print execute sql select abs(last(c2)) from tba1; +sql select abs(last(c2)) from tba1; +if $data00 != @0@ then + return -1 +endi +print execute sql select abs(last_row(c2)) from tba1; +sql select abs(last_row(c2)) from tba1; +if $data00 != @0@ then + return -1 +endi +print execute sql select abs(top(c2, 1)) from tba1; +sql_error select abs(top(c2, 1)) from tba1; +print execute sql select abs(bottom(c2, 1)) from tba1; +sql_error select abs(bottom(c2, 1)) from tba1; +print execute sql select abs(leastsquares(c2, 1, 1)) from tba1; +sql_error select abs(leastsquares(c2, 1, 1)) from tba1; +print execute sql select abs(derivative(c2, 1s, 0)) from tba1; +sql_error select abs(derivative(c2, 1s, 0)) from tba1; +print execute sql select abs(diff(c2)) from tba1; +sql_error select abs(diff(c2)) from tba1; +print execute sql select abs(csum(c2)) from tba1; +sql_error select abs(csum(c2)) from tba1; +print execute sql select abs(mavg(c2,2)) from tba1; +sql_error select abs(mavg(c2,2)) from tba1; +print execute sql select abs(sample(c2,2)) from tba1; +sql_error select abs(sample(c2,2)) from tba1; +print execute sql select abs(_block_dist()) from tba1; +sql_error select abs(_block_dist()) from tba1; diff --git a/tests/script/general/compute/math_str_query1.sim b/tests/script/general/compute/math_sqrt.sim similarity index 100% rename from tests/script/general/compute/math_str_query1.sim rename to tests/script/general/compute/math_sqrt.sim diff --git a/tests/script/general/compute/math_sqrt2.sim b/tests/script/general/compute/math_sqrt2.sim new file mode 100644 index 0000000000000000000000000000000000000000..8b0958881e7028368b486114b40f55001685d024 --- /dev/null +++ b/tests/script/general/compute/math_sqrt2.sim @@ -0,0 +1,366 @@ +sleep 100 +sql connect +sql use db; + +print execute sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; +if $data00 != @1.000000000@ then + return -1 +endi +if $data01 != @1.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data11 != @1.414213562@ then + return -1 +endi +if $data20 != @1.414213562@ then + return -1 +endi +if $data21 != @1.732050808@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data31 != @2.000000000@ then + return -1 +endi +if $data40 != @2.000000000@ then + return -1 +endi +if $data41 != @2.236067977@ then + return -1 +endi +if $data50 != @46340.950001052@ then + return -1 +endi +if $data51 != @2.449489743@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data61 != @2.645751311@ then + return -1 +endi +print execute sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba; +sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @1.414213562@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @2.000000000@ then + return -1 +endi +if $data50 != @46340.950001052@ then + return -1 +endi +if $data60 != @-nan@ then + return -1 +endi +if $data70 != @1.000000000@ then + return -1 +endi +if $data80 != @1.414213562@ then + return -1 +endi +if $data90 != @1.414213562@ then + return -1 +endi +print execute sql select sqrt(c2) from stba; +sql select sqrt(c2) from stba; +if $data00 != @1.000000000@ then + return -1 +endi +if $data10 != @1.414213562@ then + return -1 +endi +if $data20 != @1.732050808@ then + return -1 +endi +if $data30 != @2.000000000@ then + return -1 +endi +if $data40 != @2.236067977@ then + return -1 +endi +if $data50 != @2.449489743@ then + return -1 +endi +if $data60 != @2.645751311@ then + return -1 +endi +if $data70 != @2.828427125@ then + return -1 +endi +if $data80 != @3.000000000@ then + return -1 +endi +if $data90 != @0.000000000@ then + return -1 +endi +print execute sql select sqrt(min(c2)) from tba1; +sql select sqrt(min(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sqrt(max(c2)) from tba1; +sql select sqrt(max(c2)) from tba1; +if $data00 != @3.000000000@ then + return -1 +endi +print execute sql select sqrt(count(c2)) from tba1; +sql select sqrt(count(c2)) from tba1; +if $data00 != @5.477225575@ then + return -1 +endi +print execute sql select sqrt(sum(c2)) from tba1; +sql select sqrt(sum(c2)) from tba1; +if $data00 != @11.618950039@ then + return -1 +endi +print execute sql select sqrt(avg(c2)) from tba1; +sql select sqrt(avg(c2)) from tba1; +if $data00 != @2.121320344@ then + return -1 +endi +print execute sql select sqrt(percentile(c2, 10)) from tba1; +sql select sqrt(percentile(c2, 10)) from tba1; +if $data00 != @0.948683298@ then + return -1 +endi +print execute sql select sqrt(apercentile(c2, 10)) from tba1; +sql select sqrt(apercentile(c2, 10)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sqrt(stddev(c2)) from tba1; +sql select sqrt(stddev(c2)) from tba1; +if $data00 != @1.694780612@ then + return -1 +endi +print execute sql select sqrt(spread(c2)) from tba1; +sql select sqrt(spread(c2)) from tba1; +if $data00 != @3.000000000@ then + return -1 +endi +print execute sql select sqrt(twa(c2)) from tba1; +sql select sqrt(twa(c2)) from tba1; +if $data00 != @2.153585623@ then + return -1 +endi +print execute sql select sqrt(leastsquares(c2, 1, 1)) from tba1; +sql_error select sqrt(leastsquares(c2, 1, 1)) from tba1; +print execute sql select sqrt(interp(c2)) from tba1 every(1s) +sql select sqrt(interp(c2)) from tba1 every(1s) +if $data00 != @21-11-11 09:00:00.000@ then + return -1 +endi +if $data01 != @1.000000000@ then + return -1 +endi +if $data10 != @21-11-11 09:00:01.000@ then + return -1 +endi +if $data11 != @1.414213562@ then + return -1 +endi +if $data20 != @21-11-11 09:00:02.000@ then + return -1 +endi +if $data21 != @1.732050808@ then + return -1 +endi +if $data30 != @21-11-11 09:00:03.000@ then + return -1 +endi +if $data31 != @2.000000000@ then + return -1 +endi +if $data40 != @21-11-11 09:00:04.000@ then + return -1 +endi +if $data41 != @2.236067977@ then + return -1 +endi +if $data50 != @21-11-11 09:00:05.000@ then + return -1 +endi +if $data51 != @2.449489743@ then + return -1 +endi +if $data60 != @21-11-11 09:00:06.000@ then + return -1 +endi +if $data61 != @2.645751311@ then + return -1 +endi +if $data70 != @21-11-11 09:00:07.000@ then + return -1 +endi +if $data71 != @2.828427125@ then + return -1 +endi +if $data80 != @21-11-11 09:00:08.000@ then + return -1 +endi +if $data81 != @3.000000000@ 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 sqrt(interp(c2)) from stba every(1s) group by tbname; +sql select sqrt(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.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 != @1.414213562@ 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 != @1.732050808@ 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 != @2.000000000@ 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 != @2.236067977@ 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 != @2.449489743@ 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 != @2.645751311@ 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 != @2.828427125@ 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 != @3.000000000@ 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 sqrt(elapsed(ts)) from tba1; +sql select sqrt(elapsed(ts)) from tba1; +if $data00 != @170.293863659@ then + return -1 +endi +print execute sql select sqrt(rate(c2)) from tba1; +sql select sqrt(rate(c2)) from tba1; +if $data00 != @0.946864153@ then + return -1 +endi +print execute sql select sqrt(irate(c2)) from tba1; +sql select sqrt(irate(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sqrt(first(c2)) from tba1; +sql select sqrt(first(c2)) from tba1; +if $data00 != @1.000000000@ then + return -1 +endi +print execute sql select sqrt(last(c2)) from tba1; +sql select sqrt(last(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sqrt(last_row(c2)) from tba1; +sql select sqrt(last_row(c2)) from tba1; +if $data00 != @0.000000000@ then + return -1 +endi +print execute sql select sqrt(top(c2, 1)) from tba1; +sql_error select sqrt(top(c2, 1)) from tba1; +print execute sql select sqrt(bottom(c2, 1)) from tba1; +sql_error select sqrt(bottom(c2, 1)) from tba1; +print execute sql select sqrt(leastsquares(c2, 1, 1)) from tba1; +sql_error select sqrt(leastsquares(c2, 1, 1)) from tba1; +print execute sql select sqrt(derivative(c2, 1s, 0)) from tba1; +sql_error select sqrt(derivative(c2, 1s, 0)) from tba1; +print execute sql select sqrt(diff(c2)) from tba1; +sql_error select sqrt(diff(c2)) from tba1; +print execute sql select sqrt(csum(c2)) from tba1; +sql_error select sqrt(csum(c2)) from tba1; +print execute sql select sqrt(mavg(c2,2)) from tba1; +sql_error select sqrt(mavg(c2,2)) from tba1; +print execute sql select sqrt(sample(c2,2)) from tba1; +sql_error select sqrt(sample(c2,2)) from tba1; +print execute sql select sqrt(_block_dist()) from tba1; +sql_error select sqrt(_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 7baa97570cfe4c74d45be3467cc12799c53bc17c..56527d266874238675c1f45c1e681b40918389c5 100644 --- a/tests/script/general/compute/math_str_func.sim +++ b/tests/script/general/compute/math_str_func.sim @@ -45,8 +45,8 @@ sql insert into tbn values ('2021-11-11 09:00:04',true,5,5,5,5,5,5,"555","5555", sql insert into tbn values ('2021-11-11 09:00:05',true,6,6,6,6,6,6,"666","6666",6,6,6,6); sql insert into tbn values ('2021-11-11 09:00:06',true,7,7,7,7,7,7,"777","7777",7,7,7,7); -run general/compute/math_str_query1.sim -#run general/compute/math_str_query2.sim +run general/compute/math_sqrt.sim +run general/compute/math_abs.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); @@ -98,9 +98,10 @@ sql insert into tba1 values ('2021-11-11 09:00:27',true, 8,8,8,8,8,8,"888","8888 sql insert into tba1 values ('2021-11-11 09:00:28',true, 9,9,9,9,9,9,"999","9999",9,9,9,9); sql insert into tba1 values ('2021-11-11 09:00:29',true, 0,0,0,0,0,0,"000","0000",0,0,0,0); -run general/compute/math_str_query1.sim -run general/compute/math_str_query2.sim -#run general/compute/math_str_query3.sim +run general/compute/math_sqrt.sim +run general/compute/math_sqrt2.sim +run general/compute/math_abs.sim +run general/compute/math_abs2.sim #system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/compute/math_str_query2.sim b/tests/script/general/compute/math_str_query2.sim deleted file mode 100644 index fd024c3787e0fb012e804d3a4cc52dd74b95df60..0000000000000000000000000000000000000000 --- a/tests/script/general/compute/math_str_query2.sim +++ /dev/null @@ -1,111 +0,0 @@ -sleep 100 -sql connect -sql use db; -print execute sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; -sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; -if $data00 != @1.000000000@ then - return -1 -endi -if $data01 != @1.000000000@ then - return -1 -endi -if $data10 != NULL then - return -1 -endi -if $data11 != @1.414213562@ then - return -1 -endi -if $data20 != @1.414213562@ then - return -1 -endi -if $data21 != @1.732050808@ then - return -1 -endi -if $data30 != NULL then - return -1 -endi -if $data31 != @2.000000000@ then - return -1 -endi -if $data40 != @2.000000000@ then - return -1 -endi -if $data41 != @2.236067977@ then - return -1 -endi -if $data50 != @46340.950001052@ then - return -1 -endi -if $data51 != @2.449489743@ then - return -1 -endi -if $data60 != @-nan@ then - return -1 -endi -if $data61 != @2.645751311@ then - return -1 -endi -print execute sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba; -sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba; -if $data00 != @1.000000000@ then - return -1 -endi -if $data10 != NULL then - return -1 -endi -if $data20 != @1.414213562@ then - return -1 -endi -if $data30 != NULL then - return -1 -endi -if $data40 != @2.000000000@ then - return -1 -endi -if $data50 != @46340.950001052@ then - return -1 -endi -if $data60 != @-nan@ then - return -1 -endi -if $data70 != @1.000000000@ then - return -1 -endi -if $data80 != @1.414213562@ then - return -1 -endi -if $data90 != @1.414213562@ then - return -1 -endi -print execute sql select sqrt(c2) from stba; -sql select sqrt(c2) from stba; -if $data00 != @1.000000000@ then - return -1 -endi -if $data10 != @1.414213562@ then - return -1 -endi -if $data20 != @1.732050808@ then - return -1 -endi -if $data30 != @2.000000000@ then - return -1 -endi -if $data40 != @2.236067977@ then - return -1 -endi -if $data50 != @2.449489743@ then - return -1 -endi -if $data60 != @2.645751311@ then - return -1 -endi -if $data70 != @2.828427125@ then - return -1 -endi -if $data80 != @3.000000000@ then - return -1 -endi -if $data90 != @0.000000000@ then - return -1 -endi