basic1.sim 15.3 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

16
sql use test;
5
54liuyao 已提交
17 18 19


sql create table t1(ts timestamp, a int, b int , c int, d double);
20
sql create stream streams1 trigger at_once  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 已提交
21 22 23 24 25
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);
5
54liuyao 已提交
26 27 28 29 30 31

$loop_count = 0

loop0:
sleep 200

32
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
33

5
54liuyao 已提交
34 35
$loop_count = $loop_count + 1
if $loop_count == 20 then
5
54liuyao 已提交
36 37 38
  return -1
endi

5
54liuyao 已提交
39 40 41 42 43
if $rows != 4 then
  print =====rows=$rows
  goto loop0
endi

5
54liuyao 已提交
44 45
# row 0
if $data01 != 2 then
5
54liuyao 已提交
46 47
  print =====data01=$data01
  goto loop0
5
54liuyao 已提交
48 49 50
endi

if $data02 != 2 then
5
54liuyao 已提交
51 52
  print =====data02=$data02
  goto loop0
5
54liuyao 已提交
53 54 55
endi

if $data03 != 5 then
5
54liuyao 已提交
56 57
  print =====data03=$data03
  goto loop0
5
54liuyao 已提交
58 59 60
endi

if $data04 != 2 then
5
54liuyao 已提交
61 62
  print =====data04=$data04
  goto loop0
5
54liuyao 已提交
63 64 65
endi

if $data05 != 3 then
5
54liuyao 已提交
66 67
  print =====data05=$data05
  goto loop0
5
54liuyao 已提交
68 69 70 71
endi

# row 1
if $data11 != 1 then
5
54liuyao 已提交
72 73
  print =====data11=$data11
  goto loop0
5
54liuyao 已提交
74 75 76
endi

if $data12 != 1 then
5
54liuyao 已提交
77 78
  print =====data12=$data12
  goto loop0
5
54liuyao 已提交
79 80 81
endi

if $data13 != 2 then
5
54liuyao 已提交
82 83
  print =====data13=$data13
  goto loop0
5
54liuyao 已提交
84 85 86
endi

if $data14 != 2 then
5
54liuyao 已提交
87 88
  print =====data14=$data14
  goto loop0
5
54liuyao 已提交
89 90 91
endi

if $data15 != 3 then
5
54liuyao 已提交
92 93
  print =====data15=$data15
  goto loop0
5
54liuyao 已提交
94 95 96 97
endi

# row 2
if $data21 != 1 then
5
54liuyao 已提交
98
  print =====data21=$data21
5
54liuyao 已提交
99 100 101 102
  return -1
endi

if $data22 != 1 then
5
54liuyao 已提交
103
  print =====data22=$data22
5
54liuyao 已提交
104 105 106 107
  return -1
endi

if $data23 != 3 then
5
54liuyao 已提交
108
  print =====data23=$data23
5
54liuyao 已提交
109 110 111 112
  return -1
endi

if $data24 != 2 then
5
54liuyao 已提交
113
  print =====data24=$data24
5
54liuyao 已提交
114 115 116 117
  return -1
endi

if $data25 != 3 then
5
54liuyao 已提交
118
  print =====data25=$data25
5
54liuyao 已提交
119 120 121 122 123
  return -1
endi

# row 3
if $data31 != 1 then
5
54liuyao 已提交
124
  print =====data31=$data31
5
54liuyao 已提交
125 126 127 128
  return -1
endi

if $data32 != 1 then
5
54liuyao 已提交
129
  print =====data32=$data32
5
54liuyao 已提交
130 131 132 133
  return -1
endi

if $data33 != 4 then
5
54liuyao 已提交
134
  print =====data33=$data33
5
54liuyao 已提交
135 136 137 138
  return -1
endi

if $data34 != 2 then
5
54liuyao 已提交
139
  print =====data34=$data34
5
54liuyao 已提交
140 141 142 143
  return -1
endi

if $data35 != 3 then
5
54liuyao 已提交
144
  print =====data35=$data35
5
54liuyao 已提交
145 146 147 148
  return -1
endi

sql insert into t1 values(1648791223001,12,14,13,11.1);
5
54liuyao 已提交
149 150 151 152 153

$loop_count = 0
loop1:
sleep 200

154 155
sql select * from streamt;

5
54liuyao 已提交
156 157 158 159 160
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

161 162 163
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
5
54liuyao 已提交
164 165 166

if $rows != 4 then
  print ======$rows
5
54liuyao 已提交
167
  goto loop1
5
54liuyao 已提交
168 169 170 171
endi

# row 0
if $data01 != 2 then
5
54liuyao 已提交
172 173
  print =====data01=$data01
  goto loop1
5
54liuyao 已提交
174 175 176
endi

if $data02 != 2 then
5
54liuyao 已提交
177 178
  print =====data02=$data02
  goto loop1
5
54liuyao 已提交
179 180 181
endi

if $data03 != 5 then
5
54liuyao 已提交
182 183
  print =====data03=$data03
  goto loop1
5
54liuyao 已提交
184 185 186
endi

if $data04 != 2 then
5
54liuyao 已提交
187 188
  print =====data04=$data04
  goto loop1
5
54liuyao 已提交
189 190 191
endi

if $data05 != 3 then
5
54liuyao 已提交
192 193
  print =====data05=$data05
  goto loop1
5
54liuyao 已提交
194 195 196 197
endi

# row 1
if $data11 != 1 then
5
54liuyao 已提交
198 199
  print =====data11=$data11
  goto loop1
5
54liuyao 已提交
200 201 202
endi

if $data12 != 1 then
5
54liuyao 已提交
203 204
  print =====data12=$data12
  goto loop1
5
54liuyao 已提交
205 206 207
endi

if $data13 != 12 then
5
54liuyao 已提交
208 209
  print =====data13=$data13
  goto loop1
5
54liuyao 已提交
210 211 212
endi

if $data14 != 14 then
5
54liuyao 已提交
213 214
  print =====data14=$data14
  goto loop1
5
54liuyao 已提交
215 216 217
endi

if $data15 != 13 then
5
54liuyao 已提交
218 219
  print =====data15=$data15
  goto loop1
5
54liuyao 已提交
220 221 222 223
endi

# row 2
if $data21 != 1 then
5
54liuyao 已提交
224
  print =====data21=$data21
5
54liuyao 已提交
225 226 227 228
  return -1
endi

if $data22 != 1 then
5
54liuyao 已提交
229
  print =====data22=$data22
5
54liuyao 已提交
230 231 232 233
  return -1
endi

if $data23 != 3 then
5
54liuyao 已提交
234
  print =====data23=$data23
5
54liuyao 已提交
235 236 237 238
  return -1
endi

if $data24 != 2 then
5
54liuyao 已提交
239
  print =====data24=$data24
5
54liuyao 已提交
240 241 242 243
  return -1
endi

if $data25 != 3 then
5
54liuyao 已提交
244
  print =====data25=$data25
5
54liuyao 已提交
245 246 247 248 249
  return -1
endi

# row 3
if $data31 != 1 then
5
54liuyao 已提交
250
  print =====data31=$data31
5
54liuyao 已提交
251 252 253 254
  return -1
endi

if $data32 != 1 then
5
54liuyao 已提交
255
  print =====data32=$data32
5
54liuyao 已提交
256 257 258 259
  return -1
endi

if $data33 != 4 then
5
54liuyao 已提交
260
  print =====data33=$data33
5
54liuyao 已提交
261 262 263 264
  return -1
endi

if $data34 != 2 then
5
54liuyao 已提交
265
  print =====data34=$data34
5
54liuyao 已提交
266 267 268 269
  return -1
endi

if $data35 != 3 then
5
54liuyao 已提交
270
  print =====data35=$data35
5
54liuyao 已提交
271 272 273 274
  return -1
endi

sql insert into t1 values(1648791223002,12,14,13,11.1);
5
54liuyao 已提交
275 276 277 278 279

$loop_count = 0
loop2:
sleep 200

280
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
281

5
54liuyao 已提交
282 283 284 285 286
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

5
54liuyao 已提交
287 288
# row 1
if $data11 != 2 then
5
54liuyao 已提交
289 290
  print =====data11=$data11
  goto loop2
5
54liuyao 已提交
291 292 293
endi

if $data12 != 2 then
5
54liuyao 已提交
294 295
  print =====data12=$data12
  goto loop2
5
54liuyao 已提交
296 297 298
endi

if $data13 != 24 then
5
54liuyao 已提交
299 300
  print =====data13=$data13
  goto loop2
5
54liuyao 已提交
301 302 303
endi

if $data14 != 14 then
5
54liuyao 已提交
304 305
  print =====data14=$data14
  goto loop2
5
54liuyao 已提交
306 307 308
endi

if $data15 != 13 then
5
54liuyao 已提交
309 310
  print =====data15=$data15
  goto loop2
5
54liuyao 已提交
311 312 313
endi

sql insert into t1 values(1648791223003,12,14,13,11.1);
5
54liuyao 已提交
314 315 316 317 318

$loop_count = 0
loop3:
sleep 200

319
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
320

5
54liuyao 已提交
321 322 323 324 325
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

5
54liuyao 已提交
326 327
# row 1
if $data11 != 3 then
5
54liuyao 已提交
328 329
  print =====data11=$data11
  goto loop3
5
54liuyao 已提交
330 331 332
endi

if $data12 != 3 then
5
54liuyao 已提交
333 334
  print =====data12=$data12
  goto loop3
5
54liuyao 已提交
335 336 337
endi

if $data13 != 36 then
5
54liuyao 已提交
338 339
  print =====data13=$data13
  goto loop3
5
54liuyao 已提交
340 341 342
endi

if $data14 != 14 then
5
54liuyao 已提交
343 344
  print =====data14=$data14
  goto loop3
5
54liuyao 已提交
345 346 347
endi

if $data15 != 13 then
5
54liuyao 已提交
348 349
  print =====data15=$data15
  goto loop3
5
54liuyao 已提交
350 351 352 353 354
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);
5
54liuyao 已提交
355 356 357 358 359

$loop_count = 0
loop4:
sleep 200

360
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
361

5
54liuyao 已提交
362 363 364 365 366
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

5
54liuyao 已提交
367 368
# row 1
if $data11 != 3 then
5
54liuyao 已提交
369 370
  print =====data11=$data11
  goto loop4
5
54liuyao 已提交
371 372 373
endi

if $data12 != 3 then
5
54liuyao 已提交
374 375
  print =====data12=$data12
  goto loop4
5
54liuyao 已提交
376 377 378
endi

if $data13 != 6 then
5
54liuyao 已提交
379 380
  print =====data13=$data13
  goto loop4
5
54liuyao 已提交
381 382 383
endi

if $data14 != 3 then
5
54liuyao 已提交
384 385
  print =====data14=$data14
  goto loop4
5
54liuyao 已提交
386 387 388
endi

if $data15 != 1 then
5
54liuyao 已提交
389 390
  print =====data15=$data15
  goto loop4
5
54liuyao 已提交
391 392
endi

5
54liuyao 已提交
393 394 395
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);
5
54liuyao 已提交
396 397 398 399 400

$loop_count = 0
loop5:
sleep 200

401
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
402

5
54liuyao 已提交
403 404 405 406 407
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

5
54liuyao 已提交
408 409
# row 2
if $data21 != 2 then
5
54liuyao 已提交
410 411
  print =====data21=$data21
  goto loop5
5
54liuyao 已提交
412 413 414
endi

if $data22 != 2 then
5
54liuyao 已提交
415 416
  print =====data22=$data22
  goto loop5
5
54liuyao 已提交
417 418 419
endi

if $data23 != 6 then
5
54liuyao 已提交
420 421
  print =====data23=$data23
  goto loop5
5
54liuyao 已提交
422 423 424
endi

if $data24 != 2 then
5
54liuyao 已提交
425 426
  print =====data24=$data24
  goto loop5
5
54liuyao 已提交
427 428 429
endi

if $data25 != 3 then
5
54liuyao 已提交
430 431
  print =====data25=$data25
  goto loop5
5
54liuyao 已提交
432 433
endi

5
54liuyao 已提交
434
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);
5
54liuyao 已提交
435 436 437 438 439

$loop_count = 0
loop6:
sleep 200

440
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
441

5
54liuyao 已提交
442 443 444 445 446
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

5
54liuyao 已提交
447 448
# row 0
if $data01 != 4 then
5
54liuyao 已提交
449 450
  print =====data01=$data01
  goto loop6
5
54liuyao 已提交
451 452 453
endi

if $data02 != 4 then
5
54liuyao 已提交
454 455
  print =====data02=$data02
  goto loop6
5
54liuyao 已提交
456 457
endi

458
if $data03 != 50 then
5
54liuyao 已提交
459 460
  print =====data03=$data03 != 50
  goto loop6
5
54liuyao 已提交
461 462
endi

463
if $data04 != 20 then
5
54liuyao 已提交
464 465
  print =====data04=$data04 != 20
  goto loop6
5
54liuyao 已提交
466 467 468
endi

if $data05 != 3 then
5
54liuyao 已提交
469 470
  print =====data05=$data05
  goto loop6
5
54liuyao 已提交
471 472 473
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);
5
54liuyao 已提交
474 475 476 477 478

$loop_count = 0
loop7:
sleep 200

479
sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
5
54liuyao 已提交
480

5
54liuyao 已提交
481 482 483 484 485
$loop_count = $loop_count + 1
if $loop_count == 20 then
  return -1
endi

5
54liuyao 已提交
486 487
# row 1
if $data11 != 4 then
5
54liuyao 已提交
488 489
  print =====data11=$data11
  goto loop7
5
54liuyao 已提交
490 491 492
endi

if $data12 != 4 then
5
54liuyao 已提交
493 494
  print =====data12=$data12
  goto loop7
5
54liuyao 已提交
495 496
endi

497
if $data13 != 46 then
5
54liuyao 已提交
498 499
  print =====data13=$data13 != 46
  goto loop7
5
54liuyao 已提交
500 501
endi

502
if $data14 != 20 then
5
54liuyao 已提交
503 504
  print =====data14=$data14 != 20
  goto loop7
5
54liuyao 已提交
505 506 507
endi

if $data15 != 1 then
5
54liuyao 已提交
508 509
  print =====data15=$data15
  goto loop7
5
54liuyao 已提交
510 511 512 513
endi

# row 2
if $data21 != 4 then
5
54liuyao 已提交
514 515
  print =====data21=$data21
  goto loop7
5
54liuyao 已提交
516 517 518
endi

if $data22 != 4 then
5
54liuyao 已提交
519 520
  print =====data22=$data22
  goto loop7
5
54liuyao 已提交
521 522 523
endi

if $data23 != 15 then
5
54liuyao 已提交
524 525
  print =====data23=$data23
  goto loop7
5
54liuyao 已提交
526 527 528
endi

if $data24 != 4 then
5
54liuyao 已提交
529 530
  print =====data24=$data24
  goto loop7
5
54liuyao 已提交
531 532 533
endi

if $data25 != 3 then
5
54liuyao 已提交
534 535
  print =====data25=$data25
  goto loop7
5
54liuyao 已提交
536 537
endi

538 539
sql create database test2 vgroups 1;
sql select * from information_schema.ins_databases;
5
54liuyao 已提交
540

541
sql use test2;
5
54liuyao 已提交
542 543 544 545 546 547
sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
sql create table t3 using st tags(2,2,2);
sql create table t4 using st tags(2,2,2);
sql create table t5 using st tags(2,2,2);
5
54liuyao 已提交
548 549
sql create stream streams2 trigger at_once  into streamt as select  _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s);
sql create stream streams3 trigger at_once  into streamt3 as select  _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s);
5
54liuyao 已提交
550 551 552 553 554

sql insert into t1 values(1648791213000,1,1,1,1.0) t2 values(1648791213000,2,2,2,2.0) t3 values(1648791213000,3,3,3,3.0) t4 values(1648791213000,4,4,4,4.0);

$loop_count = 0

5
54liuyao 已提交
555 556
loop8:
sleep 200
5
54liuyao 已提交
557 558

$loop_count = $loop_count + 1
5
54liuyao 已提交
559
if $loop_count == 20 then
5
54liuyao 已提交
560 561 562 563 564 565 566
  return -1
endi

sql select * from streamt;

if $rows != 4 then
  print =====rows=$rows
5
54liuyao 已提交
567
  goto loop8
5
54liuyao 已提交
568 569 570 571 572 573 574
endi

sql insert into t1 values(1648791213000,5,5,5,5.0) t2 values(1648791213000,6,6,6,6.0) t5 values(1648791213000,7,7,7,7.0);


$loop_count = 0

5
54liuyao 已提交
575 576
loop9:
sleep 200
5
54liuyao 已提交
577 578

$loop_count = $loop_count + 1
5
54liuyao 已提交
579
if $loop_count == 20 then
5
54liuyao 已提交
580 581 582 583 584 585 586
  return -1
endi

sql select * from streamt order by c4 desc;

if $rows != 5 then
  print =====rows=$rows
5
54liuyao 已提交
587
  goto loop9
5
54liuyao 已提交
588 589 590 591 592
endi

# row 0
if $data01 != 1 then
  print =====data01=$data01
5
54liuyao 已提交
593
  goto loop9
5
54liuyao 已提交
594
endi
5
54liuyao 已提交
595

5
54liuyao 已提交
596 597
if $data02 != 7 then
  print =====data02=$data02
5
54liuyao 已提交
598
  goto loop9
5
54liuyao 已提交
599 600 601 602 603
endi

# row 1
if $data11 != 1 then
  print =====data11=$data11
5
54liuyao 已提交
604
  goto loop9
5
54liuyao 已提交
605 606 607 608
endi

if $data12 != 6 then
  print =====data12=$data12
5
54liuyao 已提交
609
  goto loop9
5
54liuyao 已提交
610 611 612 613 614
endi

# row 2
if $data21 != 1 then
  print =====data21=$data21
5
54liuyao 已提交
615
  goto loop9
5
54liuyao 已提交
616 617 618 619
endi

if $data22 != 5 then
  print =====data22=$data22
5
54liuyao 已提交
620
  goto loop9
5
54liuyao 已提交
621 622 623 624 625 626
endi

sql insert into t1 values(1648791213000,8,8,8,8.0);

$loop_count = 0

5
54liuyao 已提交
627 628
loop10:
sleep 200
5
54liuyao 已提交
629 630

$loop_count = $loop_count + 1
5
54liuyao 已提交
631
if $loop_count == 20 then
5
54liuyao 已提交
632 633 634 635 636 637 638 639
  return -1
endi

sql select * from streamt order by c4 desc;

# row 0
if $data01 != 1 then
  print =====data01=$data01
5
54liuyao 已提交
640
  goto loop10
5
54liuyao 已提交
641 642 643 644
endi

if $data02 != 8 then
  print =====data02=$data02
5
54liuyao 已提交
645
  goto loop10
5
54liuyao 已提交
646
endi
5
54liuyao 已提交
647

5
54liuyao 已提交
648
$loop_count = 0
5
54liuyao 已提交
649 650 651 652
loop11:
sleep 200

sql select count(*) from streamt3;
5
54liuyao 已提交
653 654

$loop_count = $loop_count + 1
5
54liuyao 已提交
655
if $loop_count == 20 then
5
54liuyao 已提交
656 657 658 659 660 661
  return -1
endi

# row 0
if $data00 != 5 then
  print =====data00=$data00
5
54liuyao 已提交
662
  goto loop11
5
54liuyao 已提交
663 664
endi

665 666 667 668 669 670 671 672 673 674 675 676 677
#max,min selectivity
sql create database test3  vgroups 1;
sql use test3;
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 stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ;

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

$loop_count = 0
5
54liuyao 已提交
678 679 680
loop12:
sleep 200

681 682 683
sql select * from streamtST3;

$loop_count = $loop_count + 1
5
54liuyao 已提交
684
if $loop_count == 20 then
685 686 687 688 689 690
  return -1
endi

# row 0
if $data02 != 1 then
  print =====data02=$data02
5
54liuyao 已提交
691
  goto loop12
692 693 694 695 696
endi

# row 1
if $data12 != 2 then
  print =====data12=$data12
5
54liuyao 已提交
697
  goto loop12
698 699
endi

700 701 702 703 704 705 706

sql create database test4  vgroups 1;
sql use test4;
sql create table t1(ts timestamp, a int, b int , c int, d double);
sql create stream streams4 trigger at_once  into streamt4 as select  _wstart, count(*) c1 from t1 where a > 5 interval(10s);
sql insert into t1 values(1648791213000,1,2,3,1.0);

5
54liuyao 已提交
707 708
$loop_count = 0
loop13:
709
sleep 200
5
54liuyao 已提交
710

711 712
sql select * from streamt4;

5
54liuyao 已提交
713 714 715 716 717
$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

718 719 720
# row 0
if $rows != 0 then
  print =====rows=$rows
5
54liuyao 已提交
721
  goto loop13
722 723 724 725 726
endi

sql insert into t1 values(1648791213000,6,2,3,1.0);

$loop_count = 0
5
54liuyao 已提交
727
loop14:
728 729 730 731 732 733 734 735 736 737
sleep 200
sql select * from streamt4;

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

if $data01 != 1 then
  print =====data01=$data01
5
54liuyao 已提交
738
  goto loop14
739 740 741 742 743
endi

sql insert into t1 values(1648791213000,2,2,3,1.0);

$loop_count = 0
5
54liuyao 已提交
744
loop15:
745 746 747 748 749 750 751 752 753 754
sleep 200
sql select * from streamt4;

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

if $rows != 0 then
  print =====rows=$rows
5
54liuyao 已提交
755
  goto loop15
756 757 758
endi


759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
sql insert into t1 values(1648791223000,2,2,3,1.0);
sql insert into t1 values(1648791223000,10,2,3,1.0);
sql insert into t1 values(1648791233000,10,2,3,1.0);

$loop_count = 0
loop16:
sleep 200
sql select * from streamt4;

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

if $rows != 2 then
  print =====rows=$rows
  goto loop16
endi

sql insert into t1 values(1648791233000,2,2,3,1.0);

$loop_count = 0
loop17:
sleep 200
sql select * from streamt4;

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

if $rows != 1 then
  print =====rows=$rows
  goto loop17
endi
794

5
54liuyao 已提交
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836
#for TS-2242
sql create database test5  vgroups 1;
sql use test5;
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 stream streams5 trigger at_once into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ;
sql create stream streams6 trigger at_once into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ;

sql_error create stream streams7 trigger at_once into streamt7 as select _wstart, count(*), _wstart, _wend, max(a) from ts1 interval(10s) ;
sql_error create stream streams8 trigger at_once into streamt8 as select count(*), _wstart, _wstart, _wend, max(a) from ts1 interval(10s) ;
sql_error create stream streams9 trigger at_once into streamt9 as select _wstart as ts, count(*), _wstart as ts, _wend, max(a) from ts1 interval(10s) ;

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

print ====== test _wstart

$loop_count = 0

loop17:

sleep 200
sql select * from streamt5;

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

if $rows != 1 then
  print =====rows=$rows
  goto loop17
endi

sql select * from streamt6;

if $rows != 1 then
  print =====rows=$rows
  goto loop17
endi

print ====== test _wstart end

837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889
print insert into ts1 values(-1648791211000,1,2,3)

sql create database test7  vgroups 1;
sql use test7;
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 stream streams7 trigger at_once into streamt7 as select _wstart, count(*) from ts1 interval(10s) ;

sql insert into ts1 values(1648791211000,1,2,3);
sql_error insert into ts1 values(-1648791211000,1,2,3);

loop18:

sleep 200
sql select * from streamt7;

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

if $rows != 1 then
  print =====rows=$rows
  goto loop18
endi

if $data01 != 1 then
  print =====data01=$data01
  goto loop18
endi

sql_error insert into ts1 values(-1648791211001,1,2,3) (1648791211001,1,2,3);

sql select _wstart, count(*) from ts1 interval(10s) ;

print $data00 $data01
print $data10 $data11

loop19:

sleep 200
sql select * from streamt7;

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

if $rows != 1 then
  print =====rows=$rows
  goto loop19
endi

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