fillHistoryBasic1.sim 7.9 KB
Newer Older
L
Liu Jicong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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 select * from information_schema.ins_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);

L
liuyao 已提交
20
sql create stream stream1 trigger at_once fill_history 1 IGNORE EXPIRED 0 IGNORE UPDATE 0  into streamt as select  _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b)  c4, min(c) c5 from t1 interval(10s);
L
Liu Jicong 已提交
21 22 23 24 25 26 27 28

sql insert into t1 values(1648791213000,1,2,3,1.0);
sql insert into t1 values(1648791223001,2,2,3,1.1);
sql insert into t1 values(1648791233002,3,2,3,2.1);
sql insert into t1 values(1648791243003,4,2,3,3.1);
sql insert into t1 values(1648791213004,4,2,3,4.1);


L
liuyao 已提交
29
$loop_count = 0
L
liuyao 已提交
30
loop00:
L
liuyao 已提交
31

L
liuyao 已提交
32
sleep 1000
L
liuyao 已提交
33 34

$loop_count = $loop_count + 1
L
liuyao 已提交
35
if $loop_count == 30 then
L
liuyao 已提交
36 37 38
  return -1
endi

L
Liu Jicong 已提交
39 40 41 42
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

if $rows != 4 then
  print ======$rows
L
liuyao 已提交
43
  goto loop00
L
Liu Jicong 已提交
44 45 46 47 48
endi

# row 0
if $data01 != 2 then
  print ======$data01
L
liuyao 已提交
49
  goto loop00
L
Liu Jicong 已提交
50 51 52 53
endi

if $data02 != 2 then
  print ======$data02
L
liuyao 已提交
54
  goto loop00
L
Liu Jicong 已提交
55 56 57 58
endi

if $data03 != 5 then
  print ======$data03
L
liuyao 已提交
59
  goto loop00
L
Liu Jicong 已提交
60 61 62 63
endi

if $data04 != 2 then
  print ======$data04
L
liuyao 已提交
64
  goto loop00
L
Liu Jicong 已提交
65 66 67 68
endi

if $data05 != 3 then
  print ======$data05
L
liuyao 已提交
69
  goto loop00
L
Liu Jicong 已提交
70 71 72 73 74
endi

# row 1
if $data11 != 1 then
  print ======$data11
L
liuyao 已提交
75
  goto loop00
L
Liu Jicong 已提交
76 77 78 79
endi

if $data12 != 1 then
  print ======$data12
L
liuyao 已提交
80
  goto loop00
L
Liu Jicong 已提交
81 82 83 84
endi

if $data13 != 2 then
  print ======$data13
L
liuyao 已提交
85
  goto loop00
L
Liu Jicong 已提交
86 87 88 89
endi

if $data14 != 2 then
  print ======$data14
L
liuyao 已提交
90
  goto loop00
L
Liu Jicong 已提交
91 92 93 94
endi

if $data15 != 3 then
  print ======$data15
L
liuyao 已提交
95
  goto loop00
L
Liu Jicong 已提交
96 97 98 99 100
endi

# row 2
if $data21 != 1 then
  print ======$data21
L
liuyao 已提交
101
  goto loop00
L
Liu Jicong 已提交
102 103 104 105
endi

if $data22 != 1 then
  print ======$data22
L
liuyao 已提交
106
  goto loop00
L
Liu Jicong 已提交
107 108 109 110
endi

if $data23 != 3 then
  print ======$data23
L
liuyao 已提交
111
  goto loop00
L
Liu Jicong 已提交
112 113 114 115
endi

if $data24 != 2 then
  print ======$data24
L
liuyao 已提交
116
  goto loop00
L
Liu Jicong 已提交
117 118 119 120
endi

if $data25 != 3 then
  print ======$data25
L
liuyao 已提交
121
  goto loop00
L
Liu Jicong 已提交
122 123 124 125 126
endi

# row 3
if $data31 != 1 then
  print ======$data31
L
liuyao 已提交
127
  goto loop00
L
Liu Jicong 已提交
128 129 130 131
endi

if $data32 != 1 then
  print ======$data32
L
liuyao 已提交
132
  goto loop00
L
Liu Jicong 已提交
133 134 135 136
endi

if $data33 != 4 then
  print ======$data33
L
liuyao 已提交
137
  goto loop00
L
Liu Jicong 已提交
138 139 140 141
endi

if $data34 != 2 then
  print ======$data34
L
liuyao 已提交
142
  goto loop00
L
Liu Jicong 已提交
143 144 145 146
endi

if $data35 != 3 then
  print ======$data35
L
liuyao 已提交
147
  goto loop00
L
Liu Jicong 已提交
148 149 150
endi

sql insert into t1 values(1648791223001,12,14,13,11.1);
L
liuyao 已提交
151 152 153 154

$loop_count = 0
loop01:

L
Liu Jicong 已提交
155
sleep 1000
L
liuyao 已提交
156 157 158 159 160 161

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

L
Liu Jicong 已提交
162 163 164 165 166 167 168 169
sql select * from streamt;

print    count(*) , count(d) , sum(a) , max(b) , min(c)
print 0: $data00 , $data01 , $data02 , $data03 , $data04 , $data05
print 1: $data10 , $data11 , $data12 , $data13 , $data14 , $data15

if $rows != 4 then
  print ======$rows
L
liuyao 已提交
170
  goto loop01
L
Liu Jicong 已提交
171 172 173 174 175
endi

# row 0
if $data01 != 2 then
  print ======$data01
L
liuyao 已提交
176
  goto loop01
L
Liu Jicong 已提交
177 178 179 180
endi

if $data02 != 2 then
  print ======$data02
L
liuyao 已提交
181
  goto loop01
L
Liu Jicong 已提交
182 183 184 185
endi

if $data03 != 5 then
  print ======$data03
L
liuyao 已提交
186
  goto loop01
L
Liu Jicong 已提交
187 188 189 190
endi

if $data04 != 2 then
  print ======$data04
L
liuyao 已提交
191
  goto loop01
L
Liu Jicong 已提交
192 193 194 195
endi

if $data05 != 3 then
  print ======$data05
L
liuyao 已提交
196
  goto loop01
L
Liu Jicong 已提交
197 198 199 200 201
endi

# row 1
if $data11 != 1 then
  print ======$data11
L
liuyao 已提交
202
  goto loop01
L
Liu Jicong 已提交
203 204 205 206
endi

if $data12 != 1 then
  print ======$data12
L
liuyao 已提交
207
  goto loop01
L
Liu Jicong 已提交
208 209 210 211
endi

if $data13 != 12 then
  print ======$data13
L
liuyao 已提交
212
  goto loop01
L
Liu Jicong 已提交
213 214 215 216
endi

if $data14 != 14 then
  print ======$data14
L
liuyao 已提交
217
  goto loop01
L
Liu Jicong 已提交
218 219 220 221
endi

if $data15 != 13 then
  print ======$data15
L
liuyao 已提交
222
  goto loop01
L
Liu Jicong 已提交
223 224 225 226 227
endi

# row 2
if $data21 != 1 then
  print ======$data21
L
liuyao 已提交
228
  goto loop01
L
Liu Jicong 已提交
229 230 231 232
endi

if $data22 != 1 then
  print ======$data22
L
liuyao 已提交
233
  goto loop01
L
Liu Jicong 已提交
234 235 236 237
endi

if $data23 != 3 then
  print ======$data23
L
liuyao 已提交
238
  goto loop01
L
Liu Jicong 已提交
239 240 241 242
endi

if $data24 != 2 then
  print ======$data24
L
liuyao 已提交
243
  goto loop01
L
Liu Jicong 已提交
244 245 246 247
endi

if $data25 != 3 then
  print ======$data25
L
liuyao 已提交
248
  goto loop01
L
Liu Jicong 已提交
249 250 251 252 253
endi

# row 3
if $data31 != 1 then
  print ======$data31
L
liuyao 已提交
254
  goto loop01
L
Liu Jicong 已提交
255 256 257 258
endi

if $data32 != 1 then
  print ======$data32
L
liuyao 已提交
259
  goto loop01
L
Liu Jicong 已提交
260 261 262 263
endi

if $data33 != 4 then
  print ======$data33
L
liuyao 已提交
264
  goto loop01
L
Liu Jicong 已提交
265 266 267 268
endi

if $data34 != 2 then
  print ======$data34
L
liuyao 已提交
269
  goto loop01
L
Liu Jicong 已提交
270 271 272 273
endi

if $data35 != 3 then
  print ======$data35
L
liuyao 已提交
274
  goto loop01
L
Liu Jicong 已提交
275 276 277
endi

sql insert into t1 values(1648791223002,12,14,13,11.1);
L
liuyao 已提交
278 279 280 281

$loop_count = 0
loop02:

L
Liu Jicong 已提交
282
sleep 1000
L
liuyao 已提交
283 284 285 286 287 288

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

L
Liu Jicong 已提交
289 290 291 292 293
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

# row 1
if $data11 != 2 then
  print ======$data11
L
liuyao 已提交
294
  goto loop02
L
Liu Jicong 已提交
295 296 297 298
endi

if $data12 != 2 then
  print ======$data12
L
liuyao 已提交
299
  goto loop02
L
Liu Jicong 已提交
300 301 302 303
endi

if $data13 != 24 then
  print ======$data13
L
liuyao 已提交
304
  goto loop02
L
Liu Jicong 已提交
305 306 307 308
endi

if $data14 != 14 then
  print ======$data14
L
liuyao 已提交
309
  goto loop02
L
Liu Jicong 已提交
310 311 312 313
endi

if $data15 != 13 then
  print ======$data15
L
liuyao 已提交
314
  goto loop02
L
Liu Jicong 已提交
315 316 317
endi

sql insert into t1 values(1648791223003,12,14,13,11.1);
L
liuyao 已提交
318 319 320 321

$loop_count = 0
loop03:

L
Liu Jicong 已提交
322
sleep 1000
L
liuyao 已提交
323 324 325 326 327 328

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

L
Liu Jicong 已提交
329 330 331 332 333
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

# row 1
if $data11 != 3 then
  print ======$data11
L
liuyao 已提交
334
  goto loop03
L
Liu Jicong 已提交
335 336 337 338
endi

if $data12 != 3 then
  print ======$data12
L
liuyao 已提交
339
  goto loop03
L
Liu Jicong 已提交
340 341 342 343
endi

if $data13 != 36 then
  print ======$data13
L
liuyao 已提交
344
  goto loop03
L
Liu Jicong 已提交
345 346 347 348
endi

if $data14 != 14 then
  print ======$data14
L
liuyao 已提交
349
  goto loop03
L
Liu Jicong 已提交
350 351 352 353
endi

if $data15 != 13 then
  print ======$data15
L
liuyao 已提交
354
  goto loop03
L
Liu Jicong 已提交
355 356 357 358 359
endi

sql insert into t1 values(1648791223001,1,1,1,1.1);
sql insert into t1 values(1648791223002,2,2,2,2.1);
sql insert into t1 values(1648791223003,3,3,3,3.1);
L
liuyao 已提交
360 361 362 363

$loop_count = 0
loop04:

L
Liu Jicong 已提交
364
sleep 1000
L
liuyao 已提交
365 366 367 368 369 370

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

L
Liu Jicong 已提交
371 372 373 374 375
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

# row 1
if $data11 != 3 then
  print ======$data11
L
liuyao 已提交
376
  goto loop04
L
Liu Jicong 已提交
377 378 379 380
endi

if $data12 != 3 then
  print ======$data12
L
liuyao 已提交
381
  goto loop04
L
Liu Jicong 已提交
382 383 384 385
endi

if $data13 != 6 then
  print ======$data13
L
liuyao 已提交
386
  goto loop04
L
Liu Jicong 已提交
387 388 389 390
endi

if $data14 != 3 then
  print ======$data14
L
liuyao 已提交
391
  goto loop04
L
Liu Jicong 已提交
392 393 394 395
endi

if $data15 != 1 then
  print ======$data15
L
liuyao 已提交
396
  goto loop04
L
Liu Jicong 已提交
397 398 399 400 401
endi

sql insert into t1 values(1648791233003,3,2,3,2.1);
sql insert into t1 values(1648791233002,5,6,7,8.1);
sql insert into t1 values(1648791233002,3,2,3,2.1);
L
liuyao 已提交
402 403 404 405

$loop_count = 0
loop1:

L
Liu Jicong 已提交
406
sleep 1000
L
liuyao 已提交
407 408 409 410 411 412

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

L
Liu Jicong 已提交
413 414 415 416 417
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

# row 2
if $data21 != 2 then
  print ======$data21
L
liuyao 已提交
418
  goto loop1
L
Liu Jicong 已提交
419 420 421 422
endi

if $data22 != 2 then
  print ======$data22
L
liuyao 已提交
423
  goto loop1
L
Liu Jicong 已提交
424 425 426 427
endi

if $data23 != 6 then
  print ======$data23
L
liuyao 已提交
428
  goto loop1
L
Liu Jicong 已提交
429 430 431 432
endi

if $data24 != 2 then
  print ======$data24
L
liuyao 已提交
433
  goto loop1
L
Liu Jicong 已提交
434 435 436 437
endi

if $data25 != 3 then
  print ======$data25
L
liuyao 已提交
438
  goto loop1
L
Liu Jicong 已提交
439 440 441
endi

sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1);
L
liuyao 已提交
442 443 444 445

$loop_count = 0
loop05:

L
Liu Jicong 已提交
446
sleep 1000
L
liuyao 已提交
447 448 449 450 451 452

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

L
Liu Jicong 已提交
453 454 455 456 457
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

# row 0
if $data01 != 4 then
  print ======$data01
L
liuyao 已提交
458
  goto loop05
L
Liu Jicong 已提交
459 460 461 462
endi

if $data02 != 4 then
  print ======$data02
L
liuyao 已提交
463
  goto loop05
L
Liu Jicong 已提交
464 465 466 467
endi

if $data03 != 50 then
  print ======$data03 != 50
L
liuyao 已提交
468
  goto loop05
L
Liu Jicong 已提交
469 470 471 472
endi

if $data04 != 20 then
  print ======$data04 != 20
L
liuyao 已提交
473
  goto loop05
L
Liu Jicong 已提交
474 475 476 477
endi

if $data05 != 3 then
  print ======$data05
L
liuyao 已提交
478
  goto loop05
L
Liu Jicong 已提交
479 480 481
endi

sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1);
L
liuyao 已提交
482 483 484 485

$loop_count = 0
loop06:

L
Liu Jicong 已提交
486
sleep 1000
L
liuyao 已提交
487 488 489 490 491 492

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

L
Liu Jicong 已提交
493 494 495 496 497
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;

# row 1
if $data11 != 4 then
  print ======$data11
L
liuyao 已提交
498
  goto loop06
L
Liu Jicong 已提交
499 500 501 502
endi

if $data12 != 4 then
  print ======$data12
L
liuyao 已提交
503
  goto loop06
L
Liu Jicong 已提交
504 505 506 507
endi

if $data13 != 46 then
  print ======$data13 != 46
L
liuyao 已提交
508
  goto loop06
L
Liu Jicong 已提交
509 510 511 512
endi

if $data14 != 20 then
  print ======$data14 != 20
L
liuyao 已提交
513
  goto loop06
L
Liu Jicong 已提交
514 515 516 517
endi

if $data15 != 1 then
  print ======$data15
L
liuyao 已提交
518
  goto loop06
L
Liu Jicong 已提交
519 520 521 522 523
endi

# row 2
if $data21 != 4 then
  print ======$data21
L
liuyao 已提交
524
  goto loop06
L
Liu Jicong 已提交
525 526 527 528
endi

if $data22 != 4 then
  print ======$data22
L
liuyao 已提交
529
  goto loop06
L
Liu Jicong 已提交
530 531 532 533
endi

if $data23 != 15 then
  print ======$data23
L
liuyao 已提交
534
  goto loop06
L
Liu Jicong 已提交
535 536 537 538
endi

if $data24 != 4 then
  print ======$data24
L
liuyao 已提交
539
  goto loop06
L
Liu Jicong 已提交
540 541 542 543
endi

if $data25 != 3 then
  print ======$data25
L
liuyao 已提交
544
  goto loop06
L
Liu Jicong 已提交
545 546
endi

L
liuyao 已提交
547
print =====over
L
Liu Jicong 已提交
548