From 7bf7dcdf180e8a692bf6138486e130d4a73476ad Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 7 Dec 2021 17:32:03 +0800 Subject: [PATCH] modify scalar_expression.sim under general/parser --- .../general/parser/scalar_expression.sim | 256 +++++++++--------- 1 file changed, 131 insertions(+), 125 deletions(-) diff --git a/tests/script/general/parser/scalar_expression.sim b/tests/script/general/parser/scalar_expression.sim index cc266d4489..07a84500aa 100644 --- a/tests/script/general/parser/scalar_expression.sim +++ b/tests/script/general/parser/scalar_expression.sim @@ -43,181 +43,187 @@ while $i < $tbNum endw print ================= step2 -$stb = $mtPrefix . 0 -$tb = $tbPrefix . 0 -print execute sql select floor(3.0)+ceil(4.0) from $tb -sql select floor(3.0)+ceil(4.0) from $tb -if $rows != 50 then - return -1 -endi -if $data00 != 7.000000000 then - return -1 -endi -if $data10 != 7.000000000 then - return -1 -endi -if $data20 != 7.000000000 then - return -1 + +print execute sql select floor(3.0)+ceil(4.0) from ct0 +sql select floor(3.0)+ceil(4.0) from ct0 +if $data00 != @7.000000000@ then + return -1 endi -if $data30 != 7.000000000 then - return -1 +if $data10 != @7.000000000@ then + return -1 endi -if $data40 != 7.000000000 then - return -1 +if $data20 != @7.000000000@ then + return -1 endi -if $data50 != 7.000000000 then - return -1 +if $data30 != @7.000000000@ then + return -1 endi -if $data60 != 7.000000000 then - return -1 +if $data40 != @7.000000000@ then + return -1 endi -if $data70 != 7.000000000 then - return -1 +if $data50 != @7.000000000@ then + return -1 endi -if $data80 != 7.000000000 then - return -1 +if $data60 != @7.000000000@ then + return -1 endi -if $data90 != 7.000000000 then - return -1 +if $data70 != @7.000000000@ then + return -1 endi - -print execute sql select sum(c1)+3.0+4.0 from $stb -sql select sum(c1)+3.0+4.0 from $stb -if $rows != 1 then - return -1 +if $data80 != @7.000000000@ then + return -1 endi -if $data00 != 2457.000000000 then - return -1 +if $data90 != @7.000000000@ then + return -1 endi -print execute sql select sin(log(avg(c1),sum(c2))+3)%4 from $stb -sql select sin(log(avg(c1),sum(c2))+3)%4 from $stb -if $rows != 1 then - return -1 +print execute sql select sum(c1)+3.0+4.0 from st0 +sql select sum(c1)+3.0+4.0 from st0 +if $data00 != @2457.000000000@ then + return -1 endi -if $data00 != -0.265074286 then - return -1 +print execute sql select sin(log(avg(c1),sum(c2))+3)%4 from st0 +sql select sin(log(avg(c1),sum(c2))+3)%4 from st0 +if $data00 != @-0.265074286@ then + return -1 endi - -print execute sql select select log(pow(length(concat('3','4')),2),c2) from $stb -sql select log(pow(length(concat('3','4')),2),c2) from $stb -print [ $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 , $data70 , $data80 , $data90 ] -if $data00 != -1.000000000 then - return -1 +print execute sql select log(pow(length(concat('3','4')),2),c2) from st0 +sql select log(pow(length(concat('3','4')),2),c2) from st0 +if $data00 != @-1.000000000@ then + return -1 endi if $data10 != @inf@ then - return -1 + return -1 endi -if $data20 != 2.000000000 then - return -1 +if $data20 != @2.000000000@ then + return -1 endi -if $data30 != 1.261859507 then - return -1 +if $data30 != @1.261859507@ then + return -1 endi -if $data40 != 1.000000000 then - return -1 +if $data40 != @1.000000000@ then + return -1 endi -if $data50 != 0.861353116 then - return -1 +if $data50 != @0.861353116@ then + return -1 endi -if $data60 != 0.773705614 then - return -1 +if $data60 != @0.773705614@ then + return -1 endi -if $data70 != 0.712414374 then - return -1 +if $data70 != @0.712414374@ then + return -1 endi -if $data80 != 0.666666667 then - return -1 +if $data80 != @0.666666667@ then + return -1 endi -if $data90 != 0.630929754 then - return -1 +if $data90 != @0.630929754@ then + return -1 endi -print execute sql select round(log(pow(length(concat('3','4')),2),c2)+floor(c3))+2 from $stb -sql select round(log(pow(length(concat('3','4')),2),c2)+floor(c3))+2 from $stb -print [ $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 , $data70 , $data80 , $data90 ] -if $data00 != 1.000000000 then - return -1 +print execute sql select round(log(pow(length(concat('3','4')),2),c2)+floor(c3))+2 from st0 +sql select round(log(pow(length(concat('3','4')),2),c2)+floor(c3))+2 from st0 +if $data00 != @1.000000000@ then + return -1 endi if $data10 != @inf@ then - return -1 + return -1 endi -if $data20 != 4.000000000 then - return -1 +if $data20 != @6.000000000@ then + return -1 endi -if $data30 != 3.000000000 then - return -1 +if $data30 != @6.000000000@ then + return -1 endi -if $data40 != 3.000000000 then - return -1 +if $data40 != @7.000000000@ then + return -1 endi -if $data50 != 3.000000000 then - return -1 +if $data50 != @8.000000000@ then + return -1 endi -if $data60 != 3.000000000 then - return -1 +if $data60 != @9.000000000@ then + return -1 endi -if $data70 != 3.000000000 then - return -1 +if $data70 != @10.000000000@ then + return -1 endi -if $data80 != 3.000000000 then - return -1 +if $data80 != @11.000000000@ then + return -1 endi -if $data90 != 3.000000000 then - return -1 +if $data90 != @12.000000000@ then + return -1 endi -$tb0 = $tbPrefix . 0 -$tb1 = $tbPrefix . 1 -print execute sql select sin(pow(c1,log(c2,2))+pow(c2,2)) as val from $tb0 union all select pow(c4,2)+tan(sin(c5)/cos(c6)) as val from $tb1 -sql select sin(pow(c1,log(c2,2))+pow(c2,2)) as val from $tb0 union all select pow(c4,2)+tan(sin(c5)/cos(c6)) as val from $tb1 -print [ $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 , $data70 , $data80 , $data90 ] +print execute sql select sin(pow(c1,log(c2,2))+pow(c2,2)) as val from ct0 union all select pow(c4,2)+tan(sin(c5)/cos(c6)) as val from ct1 +sql select sin(pow(c1,log(c2,2))+pow(c2,2)) as val from ct0 union all select pow(c4,2)+tan(sin(c5)/cos(c6)) as val from ct1 if $data00 != @-nan@ then - return -1 + return -1 endi -if $data10 != 0.909297427 then - return -1 +if $data10 != @0.909297427@ then + return -1 endi -if $data20 != -0.279415498 then - return -1 +if $data20 != @-0.279415498@ then + return -1 endi -if $data30 != 0.843325058 then - return -1 +if $data30 != @0.843325058@ then + return -1 endi -if $data40 != 0.551426681 then - return -1 +if $data40 != @0.551426681@ then + return -1 endi -if $data50 != -0.840606612 then - return -1 +if $data50 != @-0.840606612@ then + return -1 endi -if $data60 != 0.436161076 then - return -1 +if $data60 != @0.436161076@ then + return -1 endi -if $data70 != 0.897498185 then - return -1 +if $data70 != @0.897498185@ then + return -1 endi -if $data80 != -0.885952778 then - return -1 +if $data80 != @-0.885952778@ then + return -1 endi -if $data90 != 0.429470715 then - return -1 +if $data90 != @0.429470715@ then + return -1 endi -print execute sql select asin(c1) from $stb limit 1 -sql select asin(c1) from $stb limit 1 -if $data00 != 0.000000000 then - return -1 +print execute sql select asin(c1) from st0 limit 1 +sql select asin(c1) from st0 limit 1 +if $data00 != @0.000000000@ then + return -1 endi -print execute sql select pow(c1,2) from $stb limit 1 offset 2; -sql select pow(c1,2) from $stb limit 1 offset 2; -if $data00 != 4.000000000 then - return -1 +print execute sql select pow(c1,2) from st0 limit 1 offset 2; +sql select pow(c1,2) from st0 limit 1 offset 2; +if $data00 != @4.000000000@ then + return -1 endi -print exeucte sql select cos(c1) from db0.ct0, db0.ct1 where ct0.ts==ct1.ts; +print execute sql select cos(c1) from db0.ct0, db0.ct1 where ct0.ts==ct1.ts sql select cos(c1) from db0.ct0, db0.ct1 where ct0.ts==ct1.ts -if $rows != 50 then - return -1 +if $data00 != @1.000000000@ then + return -1 endi -if $data10 != 0.540302306 then - return -1 +if $data10 != @0.540302306@ then + return -1 +endi +if $data20 != @-0.416146837@ then + return -1 +endi +if $data30 != @-0.989992497@ then + return -1 +endi +if $data40 != @-0.653643621@ then + return -1 +endi +if $data50 != @0.283662185@ then + return -1 +endi +if $data60 != @0.960170287@ then + return -1 +endi +if $data70 != @0.753902254@ then + return -1 +endi +if $data80 != @-0.145500034@ then + return -1 +endi +if $data90 != @-0.911130262@ then + return -1 endi - print ============== invalid expressions sql_error select agg(c1)+c2 from $stb sql_error select agg(c1+2) from $stb -- GitLab