session0.sim 2.9 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
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 show 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,id int);
sql create stream streams2 trigger at_once  into streamt as select  _wstartts, count(*) c1,  sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s);
sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1);
sql insert into t1 values(1648791223001,10,2,3,1.1,2);
sql insert into t1 values(1648791233002,3,2,3,2.1,3);
sql insert into t1 values(1648791243003,NULL,NULL,NULL,NULL,4);
sql insert into t1 values(1648791213002,NULL,NULL,NULL,NULL,5) (1648791233012,NULL,NULL,NULL,NULL,6);
5
54liuyao 已提交
26
sleep 300
5
54liuyao 已提交
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
sql select * from streamt order by s desc;

# row 0
if $data01 != 3 then
  print ======$data01
  return -1
endi

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

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

if $data04 != 2.100000000 then
  print ======$data04
  return -1
endi

if $data05 != 0.000000000 then
  print ======$data05
  return -1
endi

if $data06 != 3 then
  print ======$data05
  return -1
endi

if $data07 != 2.100000000 then
  print ======$data05
  return -1
endi

if $data08 != 6 then
  print ======$data05
  return -1
endi

# row 1

if $data11 != 3 then
  print ======$data01
  return -1
endi

if $data12 != 10 then
  print ======$data02
  return -1
endi

if $data13 != 10 then
  print ======$data03
  return -1
endi

if $data14 != 1.100000000 then
  print ======$data04
  return -1
endi

if $data15 != 0.000000000 then
  print ======$data05
  return -1
endi

if $data16 != 10 then
  print ======$data05
  return -1
endi

if $data17 != 1.100000000 then
  print ======$data05
  return -1
endi

if $data18 != 5 then
  print ======$data05
  return -1
endi

sql insert into t1 values(1648791213000,1,2,3,1.0,7);
sql insert into t1 values(1648791223001,2,2,3,1.1,8);
sql insert into t1 values(1648791233002,3,2,3,2.1,9);
sql insert into t1 values(1648791243003,4,2,3,3.1,10);
sql insert into t1 values(1648791213002,4,2,3,4.1,11) ;
sql insert into t1 values(1648791213002,4,2,3,4.1,12) (1648791223009,4,2,3,4.1,13);
5
54liuyao 已提交
118
sleep 300
5
54liuyao 已提交
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
sql select * from streamt order by s desc ;

# row 0
if $data01 != 7 then
  print ======$data01
  return -1
endi

if $data02 != 9 then
  print ======$data02
  return -1
endi

if $data03 != 4 then
  print ======$data03
  return -1
endi

if $data04 != 1.100000000 then
  print ======$data04
  return -1
endi

if $data05 != 0.816496581 then
  print ======$data05
  return -1
endi

if $data06 != 3 then
  print ======$data05
  return -1
endi

if $data07 != 1.100000000 then
  print ======$data05
  return -1
endi

if $data08 != 13 then
  print ======$data05
  return -1
endi

system sh/exec.sh -n dnode1 -s stop -x SIGINT