triggerInterval0.sim 2.5 KB
Newer Older
5
54liuyao 已提交
1 2 3 4 5 6 7 8
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
X
Xiaoyu Wang 已提交
9
sql select * from information_schema.ins_databases
5
54liuyao 已提交
10 11 12 13 14 15 16 17
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);
18
sql create stream streams1 trigger window_close  into streamt as select  _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b)  c4, min(c) c5 from t1 interval(10s);
5
54liuyao 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31

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);
32 33 34 35 36 37

print step 0

$loop_count = 0

loop0:
5
54liuyao 已提交
38
sleep 300
39 40 41 42 43 44

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

5
54liuyao 已提交
45
sql select * from streamt;
46

5
54liuyao 已提交
47 48
if $rows != 1 then
  print ======$rows
49
  goto loop0
5
54liuyao 已提交
50 51 52 53
endi

if $data01 != 1 then
  print ======$data01
54
  goto loop0
5
54liuyao 已提交
55 56 57
endi

sql insert into t1 values(1648791233001,2,2,3,1.1);
58 59 60 61 62 63

print step 1

$loop_count = 0

loop1:
5
54liuyao 已提交
64
sleep 300
65 66 67 68 69 70

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

5
54liuyao 已提交
71 72 73
sql select * from streamt;
if $rows != 2 then
  print ======$rows
74
  goto loop1
5
54liuyao 已提交
75 76 77
endi
if $data01 != 1 then
  print ======$data01
78
  goto loop1
5
54liuyao 已提交
79 80 81
endi
if $data11 != 3 then
  print ======$data11
82
  goto loop1
5
54liuyao 已提交
83 84 85 86 87
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);
88 89 90 91 92 93

print step 2

$loop_count = 0

loop2:
5
54liuyao 已提交
94
sleep 300
95 96 97 98 99 100

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

5
54liuyao 已提交
101 102 103
sql select * from streamt;
if $rows != 2 then
  print ======$rows
104
  goto loop2
5
54liuyao 已提交
105
endi
106

5
54liuyao 已提交
107 108
if $data01 != 1 then
  print ======$data01
109
  goto loop2
5
54liuyao 已提交
110 111 112
endi
if $data11 != 5 then
  print ======$data11
113
  goto loop2
5
54liuyao 已提交
114 115 116 117 118 119
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);
120 121 122 123 124 125

print step 3

$loop_count = 0

loop3:
5
54liuyao 已提交
126
sleep 300
127 128 129 130 131 132

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

5
54liuyao 已提交
133 134 135
sql select * from streamt;
if $rows != 2 then
  print ======$rows
136
  goto loop3
5
54liuyao 已提交
137 138 139
endi
if $data01 != 2 then
  print ======$data01
140
  goto loop3
5
54liuyao 已提交
141 142 143
endi
if $data11 != 5 then
  print ======$data11
144
  goto loop3
5
54liuyao 已提交
145 146 147
endi

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