scalar.sim 2.0 KB
Newer Older
5
54liuyao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 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 86 87 88 89 90 91 92 93 94
$loop_all = 0
looptest:

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

sql drop database if exists test;
sql create database test  vgroups 1;
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 t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
sql create stream streams0 into streamt0 as select  ts c1, a, abs(b) c4 from t1 partition by a;
sql create stream streams1 into streamt1 as select  ts c1, a, abs(b) c4 from t1;
sql create stream streams2 into streamt2 as select  ts c1, a, abs(b) c4 from st partition by tbname;

sql insert into t1 values(1648791213000,1,1,1,1);
sql insert into t1 values(1648791213001,1,1,1,1);
sql insert into t1 values(1648791213002,1,1,1,1);

sql insert into t2 values(1648791213000,1,2,2,2);
sql insert into t2 values(1648791213001,1,1,1,1);
sql insert into t2 values(1648791213002,1,1,1,1);

sql insert into t1 values(1648791213001,2,11,11,11);


$loop_count = 0
loop1:

sleep 200

sql select * from streamt0 order by a desc;

$loop_count = $loop_count + 1

if $loop_count == 10 then
  return -1
endi

if $rows != 3 then
  print ======streamt0=rows=$rows
  goto loop1
endi

if $data01 != 2 then
  print ======streamt0=data01=$data01
  goto loop1
endi

if $data02 != 11 then
  print ======streamt0=data02=$data02
  goto loop1
endi


sql select * from streamt1 order by a desc;

if $rows != 3 then
  print ======streamt1=rows=$rows
  goto loop1
endi

if $data01 != 2 then
  print ======streamt1=data01=$data01
  goto loop1
endi

if $data02 != 11 then
  print ======streamt1=data02=$data02
  goto loop1
endi

sql select * from streamt2 order by a desc;

if $rows != 6 then
  print ======streamt2=rows=$rows
  goto loop1
endi

if $data01 != 2 then
  print ======streamt2=data01=$data01
  goto loop1
endi

if $data02 != 11 then
  print ======streamt2=data02=$data02
  goto loop1
endi

system sh/stop_dnodes.sh