windowClose.sim 3.2 KB
Newer Older
1 2 3 4 5 6 7
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
8
sql create database test vgroups 1;
X
Xiaoyu Wang 已提交
9
sql select * from information_schema.ins_databases
10 11 12 13 14 15 16 17 18 19 20
if $rows != 3 then
  return -1
endi

print $data00 $data01 $data02

sql use test
sql create stable st(ts timestamp, a int) tags(t int);
sql create table tu1 using st tags(1);
sql create table tu2 using st tags(2);

21
sql create stream stream1 trigger window_close into streamt as select  _wstart, sum(a) from st interval(10s);
22 23 24

sql insert into tu1 values(now, 1);

5
54liuyao 已提交
25
sleep 500
26 27 28 29 30 31
sql select * from streamt;
if $rows != 0 then
  print ======$rows
  return -1
endi

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

sql create database test1 vgroups 4;
sql use test1;
sql create stable st(ts timestamp, a int, b int) tags(t int);
sql create table t1 using st tags(1);
sql create table t2 using st tags(2);

sql create stream stream2 trigger window_close into streamt2 as select  _wstart, sum(a) from st interval(10s);
sql create stream stream3 trigger max_delay 1s into streamt3 as select  _wstart, sum(a) from st interval(10s);
sql create stream stream4 trigger window_close into streamt4 as select  _wstart, sum(a) from t1 interval(10s);
sql create stream stream5 trigger max_delay 1s into streamt5 as select  _wstart, sum(a) from t1 interval(10s);
sql create stream stream6 trigger window_close into streamt6 as select  _wstart, sum(a) from st session(ts, 10s);
sql create stream stream7 trigger max_delay 1s into streamt7 as select  _wstart, sum(a) from st session(ts, 10s);
sql create stream stream8 trigger window_close into streamt8 as select  _wstart, sum(a) from t1 session(ts, 10s);
sql create stream stream9 trigger max_delay 1s into streamt9 as select  _wstart, sum(a) from t1 session(ts, 10s);
sql create stream stream10 trigger window_close into streamt10 as select  _wstart, sum(a) from t1 state_window(b);
sql create stream stream11 trigger max_delay 1s into streamt11 as select  _wstart, sum(a) from t1 state_window(b);

sql insert into t1 values(1648791213000,1,1);
sql insert into t1 values(1648791213001,2,1);
sql insert into t1 values(1648791213002,3,1);

sql insert into t1 values(1648791233000,4,2);

$loop_count = 0

loop1:

sleep 200

$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

sql select * from streamt2;

if $rows != 1 then
  print ======streamt2=$rows
  return -1
endi

sql select * from streamt3;
if $rows != 2 then
  print ======streamt3=$rows
  goto loop1
endi

sql select * from streamt4;
if $rows != 1 then
  print ======streamt4=$rows
  return -1
endi

sql select * from streamt5;
if $rows != 2 then
  print ======streamt5=$rows
  goto loop1
endi

sql select * from streamt6;
if $rows != 1 then
  print ======streamt6=$rows
  return -1
endi

sql select * from streamt7;
if $rows != 2 then
  print ======streamt7=$rows
  goto loop1
endi

sql select * from streamt8;
if $rows != 1 then
  print ======streamt8=$rows
  return -1
endi

sql select * from streamt9;
if $rows != 2 then
  print ======streamt9=$rows
  goto loop1
endi

sql select * from streamt10;
if $rows != 1 then
  print ======streamt10=$rows
  return -1
endi

sql select * from streamt11;
if $rows != 2 then
  print ======streamt11=$rows
  goto loop1
endi

128
system sh/exec.sh -n dnode1 -s stop -x SIGINT