diff --git a/tests/script/tsim/compute/avg.sim b/tests/script/tsim/compute/avg.sim index 41a3a48251..2f7e9b83b0 100644 --- a/tests/script/tsim/compute/avg.sim +++ b/tests/script/tsim/compute/avg.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select avg(tbcol) from $tb print ===> $data00 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi @@ -53,27 +53,27 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select avg(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi print =============== step4 sql select avg(tbcol) as b from $tb print ===> $data00 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi print =============== step5 sql select avg(tbcol) as b from $tb interval(1m) print ===> $data01 -if $data10 != 1.000000000 then +if $data10 != 1.000000000 then return -1 endi sql select avg(tbcol) as b from $tb interval(1d) print ===> $data01 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi @@ -82,17 +82,17 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select avg(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data01 -if $data40 != 4.000000000 then +if $data40 != 4.000000000 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select avg(tbcol) from $mt print ===> $data00 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi @@ -101,13 +101,13 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select avg(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi sql select avg(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi @@ -115,31 +115,31 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select avg(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi print =============== step9 sql select avg(tbcol) as b from $mt interval(1m) print ===> $data10 -if $data10 != 1.000000000 then +if $data10 != 1.000000000 then return -1 endi sql select avg(tbcol) as b from $mt interval(1d) print ===> $data01 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi print =============== step10 sql select avg(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -148,18 +148,18 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select avg(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data10 -if $data10 != 1.000000000 then +if $data10 != 1.000000000 then return -1 endi -if $rows != 50 then +if $rows != 50 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/block_dist.sim b/tests/script/tsim/compute/block_dist.sim index ad33575153..2d0a4e8902 100644 --- a/tests/script/tsim/compute/block_dist.sim +++ b/tests/script/tsim/compute/block_dist.sim @@ -27,25 +27,25 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw sql create table $nt (ts timestamp, tbcol int) $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $nt values ($ms , $x ) - $x = $x + 1 + sql insert into $nt values ($ms , $x ) + $x = $x + 1 endw sql flush database $db @@ -94,7 +94,7 @@ sql_error select _block_dist() from (select * from $mt) print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/compute/bottom.sim b/tests/script/tsim/compute/bottom.sim index 141d7f314b..4ccaaf8412 100644 --- a/tests/script/tsim/compute/bottom.sim +++ b/tests/script/tsim/compute/bottom.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select bottom(tbcol, 1) from $tb print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -53,24 +53,24 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select bottom(tbcol, 1) from $tb where ts > $ms print ===> $data00 -if $data00 != 5 then +if $data00 != 5 then return -1 endi print =============== step4 sql select bottom(tbcol, 1) as b from $tb print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step5 -sql select bottom(tbcol, 2) as b from $tb +sql select bottom(tbcol, 2) as b from $tb print ===> $data00 $data10 -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data10 != 0 then +if $data10 != 0 then return -1 endi @@ -79,10 +79,10 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select bottom(tbcol, 2) as b from $tb where ts > $ms print ===> $data00 $data10 -if $data00 != 6 then +if $data00 != 6 then return -1 endi -if $data10 != 5 then +if $data10 != 5 then return -1 endi @@ -93,8 +93,8 @@ step6: print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/count.sim b/tests/script/tsim/compute/count.sim index ae8a851559..44038d5195 100644 --- a/tests/script/tsim/compute/count.sim +++ b/tests/script/tsim/compute/count.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,19 +44,19 @@ $tb = $tbPrefix . $i sql select count(*) from $tb print ===> select count(*) from $tb => $data00 -if $data00 != $rowNum then +if $data00 != $rowNum then return -1 endi sql select count(1) from $tb print ===> select count(1) from $tb => $data00 -if $data00 != $rowNum then +if $data00 != $rowNum then return -1 endi sql select count(tbcol) from $tb print ===> $data00 -if $data00 != $rowNum then +if $data00 != $rowNum then return -1 endi @@ -65,27 +65,27 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 5 then +if $data00 != 5 then return -1 endi print =============== step4 sql select count(tbcol) as b from $tb print ===> $data00 -if $data00 != $rowNum then +if $data00 != $rowNum then return -1 endi print =============== step5 sql select count(tbcol) as b from $tb interval(1m) print ===> $data00 -if $data00 != 1 then +if $data00 != 1 then return -1 endi sql select count(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != $rowNum then +if $data00 != $rowNum then return -1 endi @@ -94,30 +94,30 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data00 -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select count(*) from $mt print ===> $data00 -if $data00 != $totalNum then +if $data00 != $totalNum then return -1 endi print =============== step8 sql select count(1) from $mt print ===> $data00 -if $data00 != $totalNum then +if $data00 != $totalNum then return -1 endi sql select count(tbcol) from $mt print ===> $data00 -if $data00 != $totalNum then +if $data00 != $totalNum then return -1 endi @@ -126,13 +126,13 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 50 then +if $data00 != 50 then return -1 endi sql select count(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 100 then +if $data00 != 100 then return -1 endi @@ -140,34 +140,34 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 25 then +if $data00 != 25 then return -1 endi print =============== step9 sql select count(tbcol) as b from $mt interval(1m) print ===> $data00 -if $data00 != 10 then +if $data00 != 10 then return -1 endi -if $data10 != 10 then +if $data10 != 10 then return -1 endi sql select count(tbcol) as b from $mt interval(1d) print ===> $data00 -if $data00 != 200 then +if $data00 != 200 then return -1 endi print =============== step10 sql select count(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != $rowNum then +if $data00 != $rowNum then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -176,17 +176,17 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data01 -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $rows != 50 then +if $rows != 50 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/compute/diff.sim b/tests/script/tsim/compute/diff.sim index 0882b835c8..7e69f40b97 100644 --- a/tests/script/tsim/compute/diff.sim +++ b/tests/script/tsim/compute/diff.sim @@ -25,17 +25,17 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -43,7 +43,7 @@ $tb = $tbPrefix . $i sql select diff(tbcol) from $tb print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi @@ -52,7 +52,7 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select diff(tbcol) from $tb where ts > $ms print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi @@ -60,14 +60,14 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select diff(tbcol) from $tb where ts <= $ms print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi print =============== step4 sql select diff(tbcol) as b from $tb print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi @@ -86,8 +86,8 @@ step6: print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/diff2.sim b/tests/script/tsim/compute/diff2.sim index bd8a1223be..1cc2a87839 100644 --- a/tests/script/tsim/compute/diff2.sim +++ b/tests/script/tsim/compute/diff2.sim @@ -26,19 +26,19 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc $tinyint = $x / 128 - sql insert into $tb values ($ms , $x , $x , $x , $x , $tinyint , $x , $x , $x , $x ) + sql insert into $tb values ($ms , $x , $x , $x , $x , $tinyint , $x , $x , $x , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -46,7 +46,7 @@ $tb = $tbPrefix . $i sql select diff(c1) from $tb print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c2) from $tb @@ -56,22 +56,22 @@ if $data10 != 1.000000000 then endi sql select diff(c3) from $tb print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c4) from $tb print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c5) from $tb print ===> $data10 -if $data10 != 0 then +if $data10 != 0 then return -1 endi sql select diff(c6) from $tb print ===> $data10 -if $data10 != 1.000000000 then +if $data10 != 1.000000000 then return -1 endi @@ -90,7 +90,7 @@ sql_error select diff(c1) from m_di_tb1 where c2 like '2%' print =============== step3 sql select diff(c1) from $tb where c1 > 5 print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c2) from $tb where c2 > 5 @@ -100,38 +100,38 @@ if $data10 != 1.000000000 then endi sql select diff(c3) from $tb where c3 > 5 print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c4) from $tb where c4 > 5 print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c5) from $tb where c5 > 5 print ===> $data10 -if $data10 != 0 then +if $data10 != 0 then return -1 endi sql select diff(c6) from $tb where c6 > 5 print ===> $data10 -if $data10 != 1.000000000 then +if $data10 != 1.000000000 then return -1 endi print =============== step4 sql select diff(c1) from $tb where c1 > 5 and c2 < $rowNum print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select diff(c1) from $tb where c9 like '%9' and c1 <= 20 -if $rows != 1 then +if $rows != 1 then return -1 endi print ===> $data10 -if $data00 != 10 then +if $data00 != 10 then return -1 endi @@ -148,8 +148,8 @@ step6: print =============== clear #sql drop database $db #sql select * from information_schema.ins_databases -#if $rows != 2 then +#if $rows != 2 then # return -1 #endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/first.sim b/tests/script/tsim/compute/first.sim index 8595416c07..954664a4c6 100644 --- a/tests/script/tsim/compute/first.sim +++ b/tests/script/tsim/compute/first.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select first(tbcol) from $tb print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -53,27 +53,27 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select first(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step4 sql select first(tbcol) as b from $tb print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step5 sql select first(tbcol) as b from $tb interval(1m) print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi sql select first(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -82,17 +82,17 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select first(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data00 -if $data40 != 4 then +if $data40 != 4 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select first(tbcol) from $mt print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -101,13 +101,13 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select first(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi sql select first(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -115,7 +115,7 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select first(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -123,24 +123,24 @@ print =============== step9 sql select first(tbcol) as b from $mt interval(1m) print select first(tbcol) as b from $mt interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select first(tbcol) as b from $mt interval(1d) print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step10 sql select first(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -149,19 +149,19 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select first(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi print ===> $rows -if $rows != 50 then +if $rows != 50 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/interval.sim b/tests/script/tsim/compute/interval.sim index 903e80769b..4e7960ac4a 100644 --- a/tests/script/tsim/compute/interval.sim +++ b/tests/script/tsim/compute/interval.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,13 +44,13 @@ $tb = $tbPrefix . $i sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m) print ===> $rows -if $rows < $rowNum then +if $rows < $rowNum then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data04 != 1 then +if $data04 != 1 then return -1 endi @@ -59,16 +59,16 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m) print ===> $rows -if $rows > 10 then +if $rows > 10 then return -1 endi -if $rows < 3 then +if $rows < 3 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data04 != 1 then +if $data04 != 1 then return -1 endi @@ -81,16 +81,16 @@ $ms2 = 1601481600000 - $cc sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) print ===> $rows -if $rows < 18 then +if $rows < 18 then return -1 endi -if $rows > 22 then +if $rows > 22 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data04 != 1 then +if $data04 != 1 then return -1 endi @@ -107,29 +107,29 @@ if $rows < 30 then print expect greater than 30, actual: $rows return -1 endi -if $rows > 50 then +if $rows > 50 then return -1 endi -if $data20 != 1 then +if $data20 != 1 then return -1 endi -if $data24 != 1 then +if $data24 != 1 then return -1 endi print =============== step6 sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m) print ===> $rows -if $rows < 18 then +if $rows < 18 then return -1 endi -if $rows > 22 then +if $rows > 22 then return -1 endi -if $data10 > 15 then +if $data10 > 15 then return -1 endi -if $data10 < 5 then +if $data10 < 5 then return -1 endi @@ -138,16 +138,16 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m) print ===> $rows -if $rows < 3 then +if $rows < 3 then return -1 endi -if $rows > 7 then +if $rows > 7 then return -1 endi -if $data10 > 15 then +if $data10 > 15 then return -1 endi -if $data10 < 5 then +if $data10 < 5 then return -1 endi @@ -160,16 +160,16 @@ $ms2 = 1601481600000 - $cc sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) print ===> $rows -if $rows < 18 then +if $rows < 18 then return -1 endi -if $rows > 22 then +if $rows > 22 then return -1 endi -if $data10 > 15 then +if $data10 > 15 then return -1 endi -if $data10 < 5 then +if $data10 < 5 then return -1 endi @@ -181,24 +181,24 @@ $cc = 1 * 60000 $ms2 = 1601481600000 - $cc sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0) -if $rows < 30 then +if $rows < 30 then return -1 endi -if $rows > 50 then +if $rows > 50 then return -1 endi -if $data10 > 15 then +if $data10 > 15 then return -1 endi -if $data10 < 5 then +if $data10 < 5 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/last.sim b/tests/script/tsim/compute/last.sim index be2ee47733..e57236e57c 100644 --- a/tests/script/tsim/compute/last.sim +++ b/tests/script/tsim/compute/last.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select last(tbcol) from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -54,27 +54,27 @@ $ms = 1601481600000 + $cc sql select last(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step4 sql select last(tbcol) as b from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi print =============== step5 sql select last(tbcol) as b from $tb interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select last(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -84,17 +84,17 @@ $ms = 1601481600000 + $cc sql select last(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select last(tbcol) from $mt print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -104,13 +104,13 @@ $ms = 1601481600000 + $cc sql select last(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi sql select last(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -119,31 +119,31 @@ $ms = 1601481600000 + $cc sql select last(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step9 sql select last(tbcol) as b from $mt interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select last(tbcol) as b from $mt interval(1d) print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi print =============== step10 sql select last(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -153,19 +153,19 @@ $ms = 1601481600000 + $cc sql select last(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi print ===> $rows -if $rows != 50 then +if $rows != 50 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/last_row.sim b/tests/script/tsim/compute/last_row.sim index 57bdc36f6d..2e060dc285 100644 --- a/tests/script/tsim/compute/last_row.sim +++ b/tests/script/tsim/compute/last_row.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select last_row(tbcol) from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -54,21 +54,21 @@ $ms = 1601481600000 + $cc print select last_row(tbcol) from $tb where ts <= $ms sql select last_row(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step4 sql select last_row(tbcol) as b from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi print =============== step7 sql select last_row(tbcol) from $mt print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -77,13 +77,13 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select last_row(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi sql select last_row(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -91,18 +91,18 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select last_row(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step10 sql select last_row(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -110,28 +110,28 @@ print =============== step11 $cc = 1 * 3600000 $ms = 1601481600000 + $cc -sql insert into $tb values( $ms , 10) +sql insert into $tb values( $ms , 10) $cc = 3 * 3600000 $ms = 1601481600000 + $cc -sql insert into $tb values( $ms , null) +sql insert into $tb values( $ms , null) $cc = 5 * 3600000 $ms = 1601481600000 + $cc -sql insert into $tb values( $ms , -1) +sql insert into $tb values( $ms , -1) $cc = 7 * 3600000 $ms = 1601481600000 + $cc -sql insert into $tb values( $ms , null) +sql insert into $tb values( $ms , null) ## for super table $cc = 6 * 3600000 $ms = 1601481600000 + $cc sql select last_row(*) from $mt where ts < $ms -if $data01 != -1 then +if $data01 != -1 then return -1 endi @@ -139,12 +139,12 @@ $cc = 8 * 3600000 $ms = 1601481600000 + $cc sql select last_row(*) from $mt where ts < $ms -if $data01 != NULL then +if $data01 != NULL then return -1 endi sql select last_row(*) from $mt -if $data01 != NULL then +if $data01 != NULL then return -1 endi @@ -152,7 +152,7 @@ $cc = 4 * 3600000 $ms = 1601481600000 + $cc sql select last_row(*) from $mt where ts < $ms -if $data01 != NULL then +if $data01 != NULL then return -1 endi @@ -162,7 +162,7 @@ $cc = 4 * 3600000 $ms2 = 1601481600000 + $cc sql select last_row(*) from $mt where ts > $ms1 and ts <= $ms2 -if $data01 != NULL then +if $data01 != NULL then return -1 endi @@ -171,7 +171,7 @@ $cc = 6 * 3600000 $ms = 1601481600000 + $cc sql select last_row(*) from $tb where ts <= $ms -if $data01 != -1 then +if $data01 != -1 then return -1 endi @@ -179,12 +179,12 @@ $cc = 8 * 3600000 $ms = 1601481600000 + $cc sql select last_row(*) from $tb where ts <= $ms -if $data01 != NULL then +if $data01 != NULL then return -1 endi sql select last_row(*) from $tb -if $data01 != NULL then +if $data01 != NULL then return -1 endi @@ -192,7 +192,7 @@ $cc = 4 * 3600000 $ms = 1601481600000 + $cc sql select last_row(*) from $tb where ts <= $ms -if $data01 != NULL then +if $data01 != NULL then return -1 endi @@ -202,14 +202,14 @@ $cc = 4 * 3600000 $ms2 = 1601481600000 + $cc sql select last_row(*) from $tb where ts > $ms1 and ts <= $ms2 -if $data01 != NULL then +if $data01 != NULL then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/compute/leastsquare.sim b/tests/script/tsim/compute/leastsquare.sim index 0ead02da56..cde3c01214 100644 --- a/tests/script/tsim/compute/leastsquare.sim +++ b/tests/script/tsim/compute/leastsquare.sim @@ -25,17 +25,17 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 2 $ms = 1000 while $x < $rowNum $ms = $ms + 1000 - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -63,7 +63,7 @@ endi print =============== step5 sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m) -print ===> $data00 +print ===> $data00 if $data00 != @{slop:1.000000, intercept:1.000000}@ then return -1 endi @@ -81,15 +81,15 @@ if $data00 != @{slop:1.000000, intercept:1.000000}@ then return -1 endi print ===> $rows -if $rows != 1 then +if $rows != 1 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/max.sim b/tests/script/tsim/compute/max.sim index 21bca6be08..451eeaacd8 100644 --- a/tests/script/tsim/compute/max.sim +++ b/tests/script/tsim/compute/max.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - - sql insert into $tb values ($ms , $x ) + + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select max(tbcol) from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -54,27 +54,27 @@ $ms = 1601481600000 + $cc sql select max(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step4 sql select max(tbcol) as b from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi print =============== step5 sql select max(tbcol) as b from $tb interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select max(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -84,17 +84,17 @@ $ms = 1601481600000 + $cc sql select max(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select max(tbcol) from $mt print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -104,13 +104,13 @@ $ms = 1601481600000 + $cc sql select max(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi sql select max(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -119,31 +119,31 @@ $ms = 1601481600000 + $cc sql select max(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step9 sql select max(tbcol) as b from $mt interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select max(tbcol) as b from $mt interval(1d) print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi print =============== step10 sql select max(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -153,19 +153,19 @@ $ms = 1601481600000 + $cc sql select max(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi print ===> $rows -if $rows != 50 then +if $rows != 50 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/min.sim b/tests/script/tsim/compute/min.sim index cf22b6f2be..e8ec3232ba 100644 --- a/tests/script/tsim/compute/min.sim +++ b/tests/script/tsim/compute/min.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select min(tbcol) from $tb print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -54,27 +54,27 @@ $ms = 1601481600000 + $cc sql select min(tbcol) from $tb where ts < $ms print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step4 sql select min(tbcol) as b from $tb print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step5 sql select min(tbcol) as b from $tb interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select min(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -85,17 +85,17 @@ $ms = 1601481600000 + $cc sql select min(tbcol) as b from $tb where ts <= $ms interval(1m) print select min(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select min(tbcol) from $mt print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -104,13 +104,13 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select min(tbcol) as c from $mt where ts < $ms print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi sql select min(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi @@ -118,31 +118,31 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select min(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step9 sql select min(tbcol) as b from $mt interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select min(tbcol) as b from $mt interval(1d) print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi print =============== step10 sql select min(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 0 then +if $data00 != 0 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -151,19 +151,19 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select min(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi print ===> $rows -if $rows != 50 then +if $rows != 50 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/null.sim b/tests/script/tsim/compute/null.sim index 2dbf61bb07..d841f25265 100644 --- a/tests/script/tsim/compute/null.sim +++ b/tests/script/tsim/compute/null.sim @@ -25,24 +25,24 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - - $v1 = $x + + $v1 = $x $v2 = $x if $x == 0 then $v1 = NULL endi - - sql insert into $tb values ($ms , $v1 , $v2 ) + + sql insert into $tb values ($ms , $v1 , $v2 ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -61,47 +61,47 @@ if $rows != 20 then endi print =============== step3 -sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $tb -print ===> $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 19 then +sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $tb +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 19 then return -1 endi -if $data01 != 20 then +if $data01 != 20 then return -1 endi -if $data02 != 10.000000000 then +if $data02 != 10.000000000 then return -1 endi -if $data03 != 9.500000000 then +if $data03 != 9.500000000 then return -1 endi -if $data04 != 190 then +if $data04 != 190 then return -1 endi -if $data05 != 190 then +if $data05 != 190 then return -1 endi print =============== step4 sql select * from $tb where tbcol2 = 19 print ===> $data01 $data02 -if $rows != 1 then +if $rows != 1 then return -1 endi -if $data01 != 19 then +if $data01 != 19 then return -1 endi -if $data02 != 19 then +if $data02 != 19 then return -1 endi -sql select * from $tb where tbcol is NULL -if $rows != 1 then +sql select * from $tb where tbcol is NULL +if $rows != 1 then return -1 endi -sql select * from $tb where tbcol = NULL -if $rows != 0 then +sql select * from $tb where tbcol = NULL +if $rows != 0 then return -1 endi @@ -113,29 +113,29 @@ sql create table tt using $mt tags( NULL ) #step52: sql select * from $mt where tgcol is NULL -if $rows != 0 then +if $rows != 0 then return -1 endi print =============== step6 -sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $mt -print ===> $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 190 then +sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $mt +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 190 then return -1 endi -if $data01 != 200 then +if $data01 != 200 then return -1 endi -if $data02 != 10.000000000 then +if $data02 != 10.000000000 then return -1 endi -if $data03 != 9.500000000 then +if $data03 != 9.500000000 then return -1 endi -if $data04 != 1900 then +if $data04 != 1900 then return -1 endi -if $data05 != 1900 then +if $data05 != 1900 then return -1 endi @@ -158,15 +158,15 @@ sql insert into t7 values(now, NULL) #sql insert into t8 values(now, NULL) #sql select * from t1 -#if $rows != 1 then +#if $rows != 1 then # return -1 #endi -#if $data01 != NULL then +#if $data01 != NULL then # return -1 #endi sql select * from t2 -if $rows != 1 then +if $rows != 1 then return -1 endi if $data01 != NULL then @@ -174,7 +174,7 @@ if $data01 != NULL then endi sql select * from t3 -if $rows != 1 then +if $rows != 1 then return -1 endi if $data01 != NULL then @@ -182,7 +182,7 @@ if $data01 != NULL then endi sql select * from t4 -if $rows != 1 then +if $rows != 1 then return -1 endi if $data01 != NULL then @@ -190,7 +190,7 @@ if $data01 != NULL then endi sql select * from t5 -if $rows != 1 then +if $rows != 1 then return -1 endi if $data01 != NULL then @@ -198,7 +198,7 @@ if $data01 != NULL then endi sql select * from t6 -if $rows != 1 then +if $rows != 1 then return -1 endi if $data01 != NULL then @@ -206,7 +206,7 @@ if $data01 != NULL then endi sql select * from t7 -if $rows != 1 then +if $rows != 1 then return -1 endi if $data01 != NULL then @@ -214,7 +214,7 @@ if $data01 != NULL then endi #sql select * from t8 -#if $rows != 1 then +#if $rows != 1 then # return -1 #endi #if $data01 != NULL then @@ -224,8 +224,8 @@ endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/percentile.sim b/tests/script/tsim/compute/percentile.sim index 1ea82a998b..836a6baed5 100644 --- a/tests/script/tsim/compute/percentile.sim +++ b/tests/script/tsim/compute/percentile.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,19 +44,19 @@ $tb = $tbPrefix . $i sql select percentile(tbcol, 10) from $tb print ===> $data00 -if $data00 != 1.900000000 then +if $data00 != 1.900000000 then return -1 endi sql select percentile(tbcol, 20) from $tb print ===> $data00 -if $data00 != 3.800000000 then +if $data00 != 3.800000000 then return -1 endi sql select percentile(tbcol, 100) from $tb print ===> $data00 -if $data00 != 19.000000000 then +if $data00 != 19.000000000 then return -1 endi @@ -70,7 +70,7 @@ $ms = 1601481600000 + $cc sql select percentile(tbcol, 1) from $tb where ts > $ms print ===> $data00 -if $data00 != 5.140000000 then +if $data00 != 5.140000000 then return -1 endi @@ -79,7 +79,7 @@ $ms = 1601481600000 + $cc sql select percentile(tbcol, 5) from $tb where ts > $ms print ===> $data00 -if $data00 != 5.700000000 then +if $data00 != 5.700000000 then return -1 endi @@ -88,7 +88,7 @@ $ms = 1601481600000 + $cc sql select percentile(tbcol, 0) from $tb where ts > $ms print ===> $data00 -if $data00 != 5.000000000 then +if $data00 != 5.000000000 then return -1 endi @@ -98,7 +98,7 @@ $ms = 1601481600000 + $cc sql select percentile(tbcol, 1) as c from $tb where ts > $ms print ===> $data00 -if $data00 != 5.140000000 then +if $data00 != 5.140000000 then return -1 endi @@ -107,7 +107,7 @@ $ms = 1601481600000 + $cc sql select percentile(tbcol, 5) as c from $tb where ts > $ms print ===> $data00 -if $data00 != 5.700000000 then +if $data00 != 5.700000000 then return -1 endi @@ -116,15 +116,15 @@ $ms = 1601481600000 + $cc sql select percentile(tbcol, 0) as c from $tb where ts > $ms print ===> $data00 -if $data00 != 5.000000000 then +if $data00 != 5.000000000 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/stddev.sim b/tests/script/tsim/compute/stddev.sim index 9e7a52a774..db3af3e207 100644 --- a/tests/script/tsim/compute/stddev.sim +++ b/tests/script/tsim/compute/stddev.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select stddev(tbcol) from $tb print ===> $data00 -if $data00 != 5.766281297 then +if $data00 != 5.766281297 then return -1 endi @@ -54,27 +54,27 @@ $ms = 1601481600000 + $cc sql select stddev(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 1.414213562 then +if $data00 != 1.414213562 then return -1 endi print =============== step4 sql select stddev(tbcol) as b from $tb print ===> $data00 -if $data00 != 5.766281297 then +if $data00 != 5.766281297 then return -1 endi print =============== step5 sql select stddev(tbcol) as b from $tb interval(1m) -print ===> $data00 -if $data00 != 0.000000000 then +print ===> $data00 +if $data00 != 0.000000000 then return -1 endi sql select stddev(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != 5.766281297 then +if $data00 != 5.766281297 then return -1 endi @@ -84,18 +84,18 @@ $ms = 1601481600000 + $cc sql select stddev(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data00 -if $data00 != 0.000000000 then +if $data00 != 0.000000000 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/sum.sim b/tests/script/tsim/compute/sum.sim index 717389e061..7bb000817e 100644 --- a/tests/script/tsim/compute/sum.sim +++ b/tests/script/tsim/compute/sum.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select sum(tbcol) from $tb print ===> $data00 -if $data00 != 190 then +if $data00 != 190 then return -1 endi @@ -54,27 +54,27 @@ $ms = 1601481600000 + $cc sql select sum(tbcol) from $tb where ts <= $ms print ===> $data00 -if $data00 != 10 then +if $data00 != 10 then return -1 endi print =============== step4 sql select sum(tbcol) as b from $tb print ===> $data00 -if $data00 != 190 then +if $data00 != 190 then return -1 endi print =============== step5 sql select sum(tbcol) as b from $tb interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi sql select sum(tbcol) as b from $tb interval(1d) print ===> $data00 -if $data00 != 190 then +if $data00 != 190 then return -1 endi @@ -84,17 +84,17 @@ $ms = 1601481600000 + $cc sql select sum(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data10 -if $data10 != 1 then +if $data10 != 1 then return -1 endi -if $rows != 5 then +if $rows != 5 then return -1 endi print =============== step7 sql select sum(tbcol) from $mt print ===> $data00 -if $data00 != 1900 then +if $data00 != 1900 then return -1 endi @@ -104,13 +104,13 @@ $ms = 1601481600000 + $cc sql select sum(tbcol) as c from $mt where ts <= $ms print ===> $data00 -if $data00 != 100 then +if $data00 != 100 then return -1 endi sql select sum(tbcol) as c from $mt where tgcol < 5 print ===> $data00 -if $data00 != 950 then +if $data00 != 950 then return -1 endi @@ -119,31 +119,31 @@ $ms = 1601481600000 + $cc sql select sum(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 -if $data00 != 50 then +if $data00 != 50 then return -1 endi print =============== step9 sql select sum(tbcol) as b from $mt interval(1m) print ===> $data10 -if $data10 < 5 then +if $data10 < 5 then return -1 endi sql select sum(tbcol) as b from $mt interval(1d) print ===> $data00 -if $data00 != 1900 then +if $data00 != 1900 then return -1 endi print =============== step10 sql select sum(tbcol) as b from $mt group by tgcol print ===> $data00 -if $data00 != 190 then +if $data00 != 190 then return -1 endi -if $rows != $tbNum then +if $rows != $tbNum then return -1 endi @@ -153,19 +153,19 @@ $ms = 1601481600000 + $cc sql select sum(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1d) print select sum(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1d) -print ===> $data00 $rows -if $data00 != 10 then +print ===> $data00 $rows +if $data00 != 10 then return -1 endi -if $rows != 10 then +if $rows != 10 then return -1 endi print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/compute/top.sim b/tests/script/tsim/compute/top.sim index 75445762d0..8caf603896 100644 --- a/tests/script/tsim/compute/top.sim +++ b/tests/script/tsim/compute/top.sim @@ -25,18 +25,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -44,7 +44,7 @@ $tb = $tbPrefix . $i sql select top(tbcol, 1) from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi @@ -54,24 +54,24 @@ $ms = 1601481600000 + $cc sql select top(tbcol, 1) from $tb where ts <= $ms print ===> $data00 -if $data00 != 4 then +if $data00 != 4 then return -1 endi print =============== step4 sql select top(tbcol, 1) as b from $tb print ===> $data00 -if $data00 != 19 then +if $data00 != 19 then return -1 endi print =============== step5 -sql select top(tbcol, 2) as b from $tb +sql select top(tbcol, 2) as b from $tb print ===> $data00 $data10 -if $data00 != 18 then +if $data00 != 18 then return -1 endi -if $data10 != 19 then +if $data10 != 19 then return -1 endi @@ -81,10 +81,10 @@ $ms = 1601481600000 + $cc sql select top(tbcol, 2) as b from $tb where ts <= $ms print ===> $data00 $data10 -if $data00 != 3 then +if $data00 != 3 then return -1 endi -if $data10 != 4 then +if $data10 != 4 then return -1 endi @@ -95,8 +95,8 @@ step6: print =============== clear sql drop database $db sql select * from information_schema.ins_databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT