diff --git a/tests/script/tmp/data.sim b/tests/script/tmp/data.sim index dcfa02e0a73dd62469b6c88f2d49865a1eba0439..f43987ffcb5f5be36774a75da6dd1dea975dcbf3 100644 --- a/tests/script/tmp/data.sim +++ b/tests/script/tmp/data.sim @@ -3,6 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 0 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start @@ -44,6 +45,8 @@ if $data(4)[4] != ready then goto step1 endi +return + print =============== step2: create database sql create database db vgroups 1 replica 3 sql show databases diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index f3d418cfd16da10ed15dc39ccb99ea8ac430446d..49f0b20702ca8cb86b1c8948896da8530691b8d8 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -1,6 +1,5 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start -v sql connect @@ -22,78 +21,31 @@ if $data(1)[4] != ready then goto step1 endi -print =============== step2: create db -sql create database db -sql use db -sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql create table db.c1 using db.stb tags(101, 102, "103") - -print =============== step3: alter stb -sql_error alter table db.stb add column ts int -sql alter table db.stb add column c3 int -sql alter table db.stb add column c4 bigint -sql alter table db.stb add column c5 binary(12) -sql alter table db.stb drop column c1 -sql alter table db.stb drop column c4 -sql alter table db.stb MODIFY column c2 binary(32) -sql alter table db.stb add tag t4 bigint -sql alter table db.stb add tag c1 int -sql alter table db.stb add tag t5 binary(12) -sql alter table db.stb drop tag c1 -sql alter table db.stb drop tag t5 -sql alter table db.stb MODIFY tag t3 binary(32) -sql alter table db.stb rename tag t1 tx -sql alter table db.stb comment 'abcde' ; -sql drop table db.stb - -print =============== step4: alter tb -sql create table tb (ts timestamp, a int) -sql insert into tb values(now-28d, -28) -sql select count(a) from tb -sql alter table tb add column b smallint -sql insert into tb values(now-25d, -25, 0) -sql select count(b) from tb -sql alter table tb add column c tinyint -sql insert into tb values(now-22d, -22, 3, 0) -sql select count(c) from tb -sql alter table tb add column d int -sql insert into tb values(now-19d, -19, 6, 0, 0) -sql select count(d) from tb -sql alter table tb add column e bigint -sql alter table tb add column f float -sql alter table tb add column g double -sql alter table tb add column h binary(10) -sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb -sql select * from tb order by ts desc - -print =============== step5: alter stb and insert data -sql create table stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql show db.stables -sql describe stb -sql_error alter table stb add column ts int +$tbPrefix = tb +$tbNum = 5 +$rowNum = 10 -sql create table db.ctb using db.stb tags(101, 102, "103") -sql insert into db.ctb values(now, 1, "2") -sql show db.tables -sql select * from db.stb -sql select * from tb - -sql alter table stb add column c3 int -sql describe stb -sql select * from db.stb -sql select * from tb -sql insert into db.ctb values(now+1s, 1, 2, 3) -sql select * from db.stb - -sql alter table db.stb add column c4 bigint -sql select * from db.stb -sql insert into db.ctb values(now+2s, 1, 2, 3, 4) - -sql alter table db.stb drop column c1 -sql reset query cache -sql select * from tb -sql insert into db.ctb values(now+3s, 2, 3, 4) -sql select * from db.stb +print =============== step2: prepare data +sql create database db vgroups 2 +sql use db +sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned) + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $x = 0 + while $x < $rowNum + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , $x , $x , $x ) + $x = $x + 1 + endw + $i = $i + 1 +endw + +print =============== step3: tb +sql select count(1) from tb1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/basic3.sim b/tests/script/tsim/valgrind/basic3.sim index d513eee3cf111072c0dc570d6afd4af74b28764f..b9ed1641c89eb855e231dc2f9f662613bcf742b9 100644 --- a/tests/script/tsim/valgrind/basic3.sim +++ b/tests/script/tsim/valgrind/basic3.sim @@ -1,5 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start -v sql connect @@ -44,20 +45,11 @@ while $i < $tbNum $i = $i + 1 endw -print =============== step3: avg -sql select avg(tbcol) from tb1 -sql select avg(tbcol) from tb1 where ts <= 1601481840000 -sql select avg(tbcol) as b from tb1 -sql select avg(tbcol) as b from tb1 interval(1d) -sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m) -sql select avg(tbcol) as c from stb -sql select avg(tbcol) as c from stb where ts <= 1601481840000 -sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 -sql select avg(tbcol) as c from stb interval(1m) -sql select avg(tbcol) as c from stb interval(1d) -sql select avg(tbcol) as b from stb where ts <= 1601481840000s interval(1m) -sql select avg(tbcol) as c from stb group by tgcol -sql select avg(tbcol) as b from stb where ts <= 1601481840000s partition by tgcol interval(1m) +print =============== step3: tb +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) + +print =============== step4: stb +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index 4681345839981624732f1af37864c40beb46218a..27fd291f6436593d21fa6a4c0ae085d392ba64d9 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -42,23 +42,50 @@ while $i < $tbNum sql insert into $tb values ($ms , $x , $x , $x ) $x = $x + 1 endw + + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , NULL , NULL , NULL ) $i = $i + 1 endw -print =============== step3: avg +print =============== step3: tb sql select avg(tbcol) from tb1 sql select avg(tbcol) from tb1 where ts <= 1601481840000 sql select avg(tbcol) as b from tb1 sql select avg(tbcol) as b from tb1 interval(1d) -sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m) +sql select avg(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select bottom(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select top(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select percentile(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select leastsquares(tbcol, 1, 1) as b from tb1 where ts <= 1601481840000 +sql show table distributed tb1 +sql select count(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select diff(tbcol) from tb1 where ts <= 1601481840000 +sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20 +sql select first(tbcol), last(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m) +#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20 + +print =============== step4: stb sql select avg(tbcol) as c from stb sql select avg(tbcol) as c from stb where ts <= 1601481840000 sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 sql select avg(tbcol) as c from stb interval(1m) sql select avg(tbcol) as c from stb interval(1d) -sql select avg(tbcol) as b from stb where ts <= 1601481840000s interval(1m) +sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m) sql select avg(tbcol) as c from stb group by tgcol -sql select avg(tbcol) as b from stb where ts <= 1601481840000s partition by tgcol interval(1m) +sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql show table distributed stb +sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select diff(tbcol) from stb where ts <= 1601481840000 +sql select first(tbcol), last(tbcol) as c from stb group by tgcol +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m) +#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT