session1.sim 3.4 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 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
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), min(b), max(id) s from t1 session(ts,10s);
sql insert into t1 values(1648791210000,1,1,1,1.1,1);
sql insert into t1 values(1648791220000,2,2,2,2.1,2);
sql insert into t1 values(1648791230000,3,3,3,3.1,3);
sql insert into t1 values(1648791240000,4,4,4,4.1,4);

sql select * from streamt order by s desc;

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

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

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

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

sql insert into t1 values(1648791250005,5,5,5,5.1,5);
sql insert into t1 values(1648791260006,6,6,6,6.1,6);
sql insert into t1 values(1648791270007,7,7,7,7.1,7);
sql insert into t1 values(1648791240005,5,5,5,5.1,8) (1648791250006,6,6,6,6.1,9);

sql select * from streamt order by s desc;

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

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

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

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

# row 1
if $data11 != 1 then
  print ======$data11
  return -1
endi

if $data12 != 7 then
  print ======$data12
  return -1
endi

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

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

sql insert into t1 values(1648791280008,7,7,7,7.1,10) (1648791300009,8,8,8,8.1,11);
sql insert into t1 values(1648791260007,7,7,7,7.1,12) (1648791290008,7,7,7,7.1,13) (1648791290009,8,8,8,8.1,14);
sql insert into t1 values(1648791500000,7,7,7,7.1,15) (1648791520000,8,8,8,8.1,16) (1648791540000,8,8,8,8.1,17);
sql insert into t1 values(1648791530000,8,8,8,8.1,18);
sql insert into t1 values(1648791220000,10,10,10,10.1,19) (1648791290008,2,2,2,2.1,20) (1648791540000,17,17,17,17.1,21) (1648791500001,22,22,22,22.1,22);

sql select * from streamt order by s desc;

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

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

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

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

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

if $data12 != 33 then
  print ======$data12
  return -1
endi

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

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

# row 2
if $data21 != 4 then
  print ======$data21
  return -1
endi

if $data22 != 25 then
  print ======$data22
  return -1
endi

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

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

# row 3
if $data31 != 10 then
  print ======$data31
  return -1
endi

if $data32 != 54 then
  print ======$data32
  return -1
endi

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

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

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