distributeInterval0.sim 6.1 KB
Newer Older
5
54liuyao 已提交
1 2 3 4 5 6 7 8 9 10 11 12
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2

system sh/exec.sh -n dnode1 -s start 
sleep 50
sql connect

sql create dnode $hostname2 port 7200

system sh/exec.sh -n dnode2 -s start

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
print ===== step1
$x = 0
step1:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
if $rows != 2 then
  return -1
endi
if $data(1)[4] != ready then
  goto step1
endi
if $data(2)[4] != ready then
  goto step1
endi

print ===== step2

5
54liuyao 已提交
37 38 39 40 41 42 43
sql create database test  vgroups 4;
sql use test;
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
sql create table ts3 using st tags(3,2,2);
sql create table ts4 using st tags(4,2,2);
44
sql create stream stream_t1 trigger at_once watermark 1d into streamtST1 as select  _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b)  c4, min(c) c5 from st interval(10s);
5
54liuyao 已提交
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

sleep 1000

sql insert into ts1 values(1648791213001,1,12,3,1.0);
sql insert into ts2 values(1648791213001,1,12,3,1.0);

sql insert into ts3 values(1648791213001,1,12,3,1.0);
sql insert into ts4 values(1648791213001,1,12,3,1.0);

sql insert into ts1 values(1648791213002,NULL,NULL,NULL,NULL);
sql insert into ts2 values(1648791213002,NULL,NULL,NULL,NULL);

sql insert into ts3 values(1648791213002,NULL,NULL,NULL,NULL);
sql insert into ts4 values(1648791213002,NULL,NULL,NULL,NULL);

sql insert into ts1 values(1648791223002,2,2,3,1.1);
sql insert into ts1 values(1648791233003,3,2,3,2.1);
sql insert into ts2 values(1648791243004,4,2,43,73.1);
sql insert into ts1 values(1648791213002,24,22,23,4.1);
sql insert into ts1 values(1648791243005,4,20,3,3.1);
sql insert into ts2 values(1648791243006,4,2,3,3.1) (1648791243007,4,2,3,3.1) ;
sql insert into ts1 values(1648791243008,4,2,30,3.1) (1648791243009,4,2,3,3.1)  (1648791243010,4,2,3,3.1)  ;
sql insert into ts2 values(1648791243011,4,2,3,3.1) (1648791243012,34,32,33,3.1)  (1648791243013,4,2,3,3.1) (1648791243014,4,2,13,3.1);
sql insert into ts1 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
sql insert into ts2 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ;
sql insert into ts1 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0)  (1648791223001,22,22,83,1.1) ;

sql insert into ts3 values(1648791223002,2,2,3,1.1);
sql insert into ts4 values(1648791233003,3,2,3,2.1);
sql insert into ts3 values(1648791243004,4,2,43,73.1);
sql insert into ts4 values(1648791213002,24,22,23,4.1);
sql insert into ts3 values(1648791243005,4,20,3,3.1);
sql insert into ts4 values(1648791243006,4,2,3,3.1) (1648791243007,4,2,3,3.1) ;
sql insert into ts3 values(1648791243008,4,2,30,3.1) (1648791243009,4,2,3,3.1)  (1648791243010,4,2,3,3.1)  ;
sql insert into ts4 values(1648791243011,4,2,3,3.1) (1648791243012,34,32,33,3.1)  (1648791243013,4,2,3,3.1) (1648791243014,4,2,13,3.1);
sql insert into ts3 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
sql insert into ts4 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ;
sql insert into ts3 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0)  (1648791223001,22,22,83,1.1) ;

$loop_count = 0
loop1:
5
54liuyao 已提交
86
sleep 300
5
54liuyao 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99
sql select * from streamtST1;

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

# row 0
if $data01 != 8 then
  print =====data01=$data01
  goto loop1
endi

H
Haojun Liao 已提交
100
if $data02 != 6 then
5
54liuyao 已提交
101 102 103 104
  print =====data02=$data02
  goto loop1
endi

H
Haojun Liao 已提交
105 106
if $data03 != 52 then
  print ======data03=$data03
5
54liuyao 已提交
107
  goto loop1
5
54liuyao 已提交
108 109 110
endi

if $data04 != 52 then
H
Haojun Liao 已提交
111
  print ======data04=$data04
5
54liuyao 已提交
112
  goto loop1
5
54liuyao 已提交
113 114 115
endi

if $data05 != 13 then
H
Haojun Liao 已提交
116
  print ======data05=$data05
5
54liuyao 已提交
117
  goto loop1
5
54liuyao 已提交
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
endi

# row 1
if $data11 != 6 then
  print =====data11=$data11
  goto loop1
endi

if $data12 != 6 then
  print =====data12=$data12
  goto loop1
endi

if $data13 != 92 then
  print ======$data13
  return -1
endi

if $data14 != 22 then
  print ======$data14
  return -1
endi

if $data15 != 3 then
  print ======$data15
  return -1
endi

# row 2
if $data21 != 4 then
  print =====data21=$data21
  goto loop1
endi

if $data22 != 4 then
  print =====data22=$data22
  goto loop1
endi

if $data23 != 32 then
  print ======$data23
  return -1
endi

if $data24 != 12 then
  print ======$data24
  return -1
endi

if $data25 != 3 then
  print ======$data25
  return -1
endi

# row 3
if $data31 != 30 then
  print =====data31=$data31
  goto loop1
endi

if $data32 != 30 then
  print =====data32=$data32
  goto loop1
endi

if $data33 != 180 then
  print ======$data33
  return -1
endi

if $data34 != 42 then
  print ======$data34
  return -1
endi

if $data35 != 3 then
  print ======$data35
  return -1
endi

198
sql select  _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b)  c4, min(c) c5, avg(d) from st interval(10s);
5
54liuyao 已提交
199

5
54liuyao 已提交
200 201 202 203 204 205

sql create database test1  vgroups 1;
sql use test1;
sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
206
sql create stream stream_t2 trigger at_once  watermark 20s into streamtST1 as select  _wstart, count(*) c1, count(a) c2 , sum(a) c3 ,  max(b)  c5, min(c) c6 from st interval(10s) ;
5
54liuyao 已提交
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234

sql insert into ts1 values(1648791211000,1,2,3);
sql insert into ts1 values(1648791222001,2,2,3);
sql insert into ts2 values(1648791211000,1,2,3);
sql insert into ts2 values(1648791222001,2,2,3);

$loop_count = 0
loop2:
sql select * from streamtST1;

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

# row 0
if $data01 != 2 then
  print =====data01=$data01
  goto loop2
endi

#rows 1
if $data11 != 2 then
  print =====data11=$data11
  goto loop2
endi

L
Liu Jicong 已提交
235
system sh/stop_dnodes.sh