185 lines
4.0 KiB
Plaintext
185 lines
4.0 KiB
Plaintext
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
|
|
sql show databases
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01 $data02
|
|
|
|
sql use test
|
|
sql create table t1(ts timestamp, a int, b int , c int, d double);
|
|
sql create stream streams1 trigger window_close into streamt as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s);
|
|
|
|
sql insert into t1 values(1648791213001,1,2,3,1.0);
|
|
sleep 300
|
|
sql select * from streamt;
|
|
if $rows != 0 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t1 values(1648791223001,2,2,3,1.1);
|
|
sql insert into t1 values(1648791223002,2,2,3,1.1);
|
|
sql insert into t1 values(1648791223003,2,2,3,1.1);
|
|
sql insert into t1 values(1648791223001,2,2,3,1.1);
|
|
sleep 300
|
|
sql select * from streamt;
|
|
if $rows != 1 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t1 values(1648791233001,2,2,3,1.1);
|
|
sleep 300
|
|
sql select * from streamt;
|
|
if $rows != 2 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
if $data11 != 3 then
|
|
print ======$data11
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t1 values(1648791223004,2,2,3,1.1);
|
|
sql insert into t1 values(1648791223004,2,2,3,1.1);
|
|
sql insert into t1 values(1648791223005,2,2,3,1.1);
|
|
sleep 300
|
|
sql select * from streamt;
|
|
if $rows != 2 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
if $data11 != 5 then
|
|
print ======$data11
|
|
return -1
|
|
endi
|
|
|
|
|
|
sql insert into t1 values(1648791233002,3,2,3,2.1);
|
|
sql insert into t1 values(1648791213002,4,2,3,3.1)
|
|
sql insert into t1 values(1648791213002,4,2,3,4.1);
|
|
sleep 300
|
|
sql select * from streamt;
|
|
if $rows != 2 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 2 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
if $data11 != 5 then
|
|
print ======$data11
|
|
return -1
|
|
endi
|
|
|
|
sql create table t2(ts timestamp, a int, b int , c int, d double);
|
|
sql create stream streams2 trigger window_close watermark 20s into streamt2 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 interval(10s);
|
|
sql insert into t2 values(1648791213000,1,2,3,1.0);
|
|
sql insert into t2 values(1648791239999,1,2,3,1.0);
|
|
sleep 300
|
|
sql select * from streamt2;
|
|
if $rows != 0 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t2 values(1648791240000,1,2,3,1.0);
|
|
sleep 300
|
|
sql select * from streamt2;
|
|
if $rows != 1 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t2 values(1648791250001,1,2,3,1.0) (1648791250002,1,2,3,1.0) (1648791250003,1,2,3,1.0) (1648791240000,1,2,3,1.0);
|
|
sleep 300
|
|
sql select * from streamt2;
|
|
if $rows != 1 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t2 values(1648791280000,1,2,3,1.0);
|
|
sleep 300
|
|
sql select * from streamt2;
|
|
if $rows != 4 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
if $data11 != 1 then
|
|
print ======$data11
|
|
return -1
|
|
endi
|
|
if $data21 != 1 then
|
|
print ======$data21
|
|
return -1
|
|
endi
|
|
if $data31 != 3 then
|
|
print ======$data31
|
|
return -1
|
|
endi
|
|
|
|
sql insert into t2 values(1648791250001,1,2,3,1.0) (1648791250002,1,2,3,1.0) (1648791250003,1,2,3,1.0) (1648791280000,1,2,3,1.0) (1648791280001,1,2,3,1.0) (1648791280002,1,2,3,1.0) (1648791310000,1,2,3,1.0) (1648791280001,1,2,3,1.0);
|
|
sleep 300
|
|
sql select * from streamt2;
|
|
|
|
if $rows != 5 then
|
|
print ======$rows
|
|
return -1
|
|
endi
|
|
if $data01 != 1 then
|
|
print ======$data01
|
|
return -1
|
|
endi
|
|
if $data11 != 1 then
|
|
print ======$data11
|
|
return -1
|
|
endi
|
|
if $data21 != 1 then
|
|
print ======$data21
|
|
return -1
|
|
endi
|
|
if $data31 != 3 then
|
|
print ======$data31
|
|
return -1
|
|
endi
|
|
if $data41 != 3 then
|
|
print ======$data31
|
|
return -1
|
|
endi
|
|
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT |