TDengine/tests/script/tsim/stream/triggerSession0.sim

158 lines
2.8 KiB
Text
Raw Normal View History

2022-05-27 08:03:43 +00:00
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect
print =============== create database
sql create database test vgroups 1;
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-05-27 08:03:43 +00:00
if $rows != 3 then
return -1
endi
print $data00 $data01 $data02
2022-10-18 09:44:00 +00:00
sql use test;
2022-05-27 08:03:43 +00:00
sql create table t2(ts timestamp, a int, b int , c int, d double);
2023-04-24 07:01:56 +00:00
sql create stream streams2 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s);
2022-05-27 08:03:43 +00:00
2024-07-18 10:54:27 +00:00
run tsim/stream/checkTaskStatus.sim
2022-05-27 08:03:43 +00:00
sql insert into t2 values(1648791213000,1,2,3,1.0);
sql insert into t2 values(1648791222999,1,2,3,1.0);
sql insert into t2 values(1648791223000,1,2,3,1.0);
sql insert into t2 values(1648791223001,1,2,3,1.0);
sql insert into t2 values(1648791233001,1,2,3,1.0);
2023-04-20 01:25:33 +00:00
$loop_count = 0
loop0:
sleep 1000
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
2022-05-27 08:03:43 +00:00
sql select * from streamt2;
if $rows != 0 then
print ======$rows
2023-04-20 01:25:33 +00:00
goto loop0
2022-05-27 08:03:43 +00:00
endi
sql insert into t2 values(1648791243002,1,2,3,1.0);
2023-04-20 01:25:33 +00:00
loop1:
sleep 1000
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
2022-05-27 08:03:43 +00:00
sql select * from streamt2;
2023-04-20 01:25:33 +00:00
2022-05-27 08:03:43 +00:00
if $rows != 1 then
print ======$rows
2023-04-20 01:25:33 +00:00
goto loop1
2022-05-27 08:03:43 +00:00
endi
if $data01 != 5 then
print ======$data01
2023-04-20 01:25:33 +00:00
goto loop1
2022-05-27 08:03:43 +00:00
endi
sql insert into t2 values(1648791223001,1,2,3,1.0) (1648791223002,1,2,3,1.0) (1648791222999,1,2,3,1.0);
2023-04-20 01:25:33 +00:00
loop2:
sleep 1000
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
2022-05-27 08:03:43 +00:00
sql select * from streamt2;
2023-04-20 01:25:33 +00:00
2022-05-27 08:03:43 +00:00
if $rows != 1 then
print ======$rows
2023-04-20 01:25:33 +00:00
goto loop2
2022-05-27 08:03:43 +00:00
endi
if $data01 != 6 then
print ======$data01
2023-04-20 01:25:33 +00:00
goto loop2
2022-05-27 08:03:43 +00:00
endi
sql insert into t2 values(1648791233002,1,2,3,1.0);
2023-04-20 01:25:33 +00:00
loop3:
sleep 1000
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
2022-05-27 08:03:43 +00:00
sql select * from streamt2;
2023-04-20 01:25:33 +00:00
2022-10-18 09:44:00 +00:00
if $rows != 0 then
2022-05-27 08:03:43 +00:00
print ======$rows
2023-04-20 01:25:33 +00:00
goto loop3
2022-05-27 08:03:43 +00:00
endi
sql insert into t2 values(1648791253003,1,2,3,1.0);
2023-04-20 01:25:33 +00:00
loop4:
sleep 1000
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
2022-05-27 08:03:43 +00:00
sql select * from streamt2;
2023-04-20 01:25:33 +00:00
2022-05-27 08:03:43 +00:00
if $rows != 1 then
print ======$rows
2023-04-20 01:25:33 +00:00
goto loop4
2022-05-27 08:03:43 +00:00
endi
if $data01 != 8 then
print ======$data01
2023-04-20 01:25:33 +00:00
goto loop4
2022-05-27 08:03:43 +00:00
endi
sql insert into t2 values(1648791243003,1,2,3,1.0) (1648791243002,1,2,3,1.0) (1648791270004,1,2,3,1.0) (1648791280005,1,2,3,1.0) (1648791290006,1,2,3,1.0);
2023-04-20 01:25:33 +00:00
loop5:
sleep 1000
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
2022-05-27 08:03:43 +00:00
sql select * from streamt2;
2023-04-20 01:25:33 +00:00
2022-05-27 08:03:43 +00:00
if $rows != 3 then
2022-06-18 11:42:03 +00:00
print =====rows=$rows
2023-04-20 01:25:33 +00:00
goto loop5
2022-05-27 08:03:43 +00:00
endi
if $data01 != 10 then
print ======$data01
2023-04-20 01:25:33 +00:00
goto loop5
2022-05-27 08:03:43 +00:00
endi
if $data11 != 1 then
print ======$data11
2023-04-20 01:25:33 +00:00
goto loop5
2022-05-27 08:03:43 +00:00
endi
if $data21 != 1 then
print ======$data21
2023-04-20 01:25:33 +00:00
goto loop5
2022-05-27 08:03:43 +00:00
endi
2022-06-04 12:06:07 +00:00
system sh/exec.sh -n dnode1 -s stop -x SIGINT