triggerSession0.sim 2.7 KB
Newer Older
5
54liuyao 已提交
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
5
54liuyao 已提交
10 11 12 13 14 15
if $rows != 3 then
  return -1
endi

print $data00 $data01 $data02

5
54liuyao 已提交
16
sql use test;
5
54liuyao 已提交
17
sql create table t2(ts timestamp, a int, b int , c int, d double);
L
liuyao 已提交
18
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);
5
54liuyao 已提交
19 20 21 22 23 24

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);
L
liuyao 已提交
25 26 27 28 29 30 31 32 33 34 35

$loop_count = 0

loop0:
sleep 1000

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

5
54liuyao 已提交
36 37 38
sql select * from streamt2;
if $rows != 0 then
  print ======$rows
L
liuyao 已提交
39
  goto loop0
5
54liuyao 已提交
40 41 42
endi

sql insert into t2 values(1648791243002,1,2,3,1.0);
L
liuyao 已提交
43 44 45 46 47 48 49 50 51

loop1:
sleep 1000

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

5
54liuyao 已提交
52
sql select * from streamt2;
L
liuyao 已提交
53

5
54liuyao 已提交
54 55
if $rows != 1 then
  print ======$rows
L
liuyao 已提交
56
  goto loop1
5
54liuyao 已提交
57 58 59 60
endi

if $data01 != 5 then
  print ======$data01
L
liuyao 已提交
61
  goto loop1
5
54liuyao 已提交
62 63 64
endi

sql insert into t2 values(1648791223001,1,2,3,1.0) (1648791223002,1,2,3,1.0) (1648791222999,1,2,3,1.0);
L
liuyao 已提交
65 66 67 68 69 70 71 72 73

loop2:
sleep 1000

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

5
54liuyao 已提交
74
sql select * from streamt2;
L
liuyao 已提交
75

5
54liuyao 已提交
76 77
if $rows != 1 then
  print ======$rows
L
liuyao 已提交
78
  goto loop2
5
54liuyao 已提交
79 80 81 82
endi

if $data01 != 6 then
  print ======$data01
L
liuyao 已提交
83
  goto loop2
5
54liuyao 已提交
84 85 86
endi

sql insert into t2 values(1648791233002,1,2,3,1.0);
L
liuyao 已提交
87 88 89 90 91 92 93 94 95

loop3:
sleep 1000

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

5
54liuyao 已提交
96
sql select * from streamt2;
L
liuyao 已提交
97

5
54liuyao 已提交
98
if $rows != 0 then
5
54liuyao 已提交
99
  print ======$rows
L
liuyao 已提交
100
  goto loop3
5
54liuyao 已提交
101 102 103
endi

sql insert into t2 values(1648791253003,1,2,3,1.0);
L
liuyao 已提交
104 105 106 107 108 109 110 111 112 113

loop4:
sleep 1000

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


5
54liuyao 已提交
114
sql select * from streamt2;
L
liuyao 已提交
115

5
54liuyao 已提交
116 117
if $rows != 1 then
  print ======$rows
L
liuyao 已提交
118
  goto loop4
5
54liuyao 已提交
119 120 121 122
endi

if $data01 != 8 then
  print ======$data01
L
liuyao 已提交
123
  goto loop4
5
54liuyao 已提交
124 125 126
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);
L
liuyao 已提交
127 128 129 130 131 132 133 134 135

loop5:
sleep 1000

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

5
54liuyao 已提交
136
sql select * from streamt2;
L
liuyao 已提交
137

5
54liuyao 已提交
138
if $rows != 3 then
5
54liuyao 已提交
139
  print =====rows=$rows
L
liuyao 已提交
140
  goto loop5
5
54liuyao 已提交
141 142 143 144
endi

if $data01 != 10 then
  print ======$data01
L
liuyao 已提交
145
  goto loop5
5
54liuyao 已提交
146 147 148
endi
if $data11 != 1 then
  print ======$data11
L
liuyao 已提交
149
  goto loop5
5
54liuyao 已提交
150 151 152
endi
if $data21 != 1 then
  print ======$data21
L
liuyao 已提交
153
  goto loop5
5
54liuyao 已提交
154 155
endi

5
54liuyao 已提交
156
system sh/exec.sh -n dnode1 -s stop -x SIGINT