condition.sim 9.5 KB
Newer Older
D
dapan1121 已提交
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
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablespervnode -v 4
system sh/exec.sh -n dnode1 -s start

sleep 100
sql connect

sql drop database if exists cdb
sql create database if not exists cdb 
sql use cdb
sql create table stb1 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double)

sql create table tb1 using stb1 tags(1,'1',1.0)
sql create table tb2 using stb1 tags(2,'2',2.0)
sql create table tb3 using stb1 tags(3,'3',3.0)
sql create table tb4 using stb1 tags(4,'4',4.0)
sql create table tb5 using stb1 tags(5,'5',5.0)
sql create table tb6 using stb1 tags(6,'6',6.0)

sql insert into tb1 values ('2021-05-05 18:19:00',1,1.0,1,1,1,1.0,true ,'1','1')
sql insert into tb1 values ('2021-05-05 18:19:01',2,2.0,2,2,2,2.0,true ,'2','2')
sql insert into tb1 values ('2021-05-05 18:19:02',3,3.0,3,3,3,3.0,false,'3','3')
sql insert into tb1 values ('2021-05-05 18:19:03',4,4.0,4,4,4,4.0,false,'4','4')
sql insert into tb1 values ('2021-05-05 18:19:04',11,11.0,11,11,11,11.0,true ,'11','11')
sql insert into tb1 values ('2021-05-05 18:19:05',12,12.0,12,12,12,12.0,true ,'12','12')
sql insert into tb1 values ('2021-05-05 18:19:06',13,13.0,13,13,13,13.0,false,'13','13')
sql insert into tb1 values ('2021-05-05 18:19:07',14,14.0,14,14,14,14.0,false,'14','14')
sql insert into tb2 values ('2021-05-05 18:19:08',21,21.0,21,21,21,21.0,true ,'21','21')
sql insert into tb2 values ('2021-05-05 18:19:09',22,22.0,22,22,22,22.0,true ,'22','22')
sql insert into tb2 values ('2021-05-05 18:19:10',23,23.0,23,23,23,23.0,false,'23','23')
sql insert into tb2 values ('2021-05-05 18:19:11',24,24.0,24,24,24,24.0,false,'24','24')
sql insert into tb3 values ('2021-05-05 18:19:12',31,31.0,31,31,31,31.0,true ,'31','31')
sql insert into tb3 values ('2021-05-05 18:19:13',32,32.0,32,32,32,32.0,true ,'32','32')
sql insert into tb3 values ('2021-05-05 18:19:14',33,33.0,33,33,33,33.0,false,'33','33')
sql insert into tb3 values ('2021-05-05 18:19:15',34,34.0,34,34,34,34.0,false,'34','34')
sql insert into tb4 values ('2021-05-05 18:19:16',41,41.0,41,41,41,41.0,true ,'41','41')
sql insert into tb4 values ('2021-05-05 18:19:17',42,42.0,42,42,42,42.0,true ,'42','42')
sql insert into tb4 values ('2021-05-05 18:19:18',43,43.0,43,43,43,43.0,false,'43','43')
sql insert into tb4 values ('2021-05-05 18:19:19',44,44.0,44,44,44,44.0,false,'44','44')
sql insert into tb5 values ('2021-05-05 18:19:20',51,51.0,51,51,51,51.0,true ,'51','51')
sql insert into tb5 values ('2021-05-05 18:19:21',52,52.0,52,52,52,52.0,true ,'52','52')
sql insert into tb5 values ('2021-05-05 18:19:22',53,53.0,53,53,53,53.0,false,'53','53')
sql insert into tb5 values ('2021-05-05 18:19:23',54,54.0,54,54,54,54.0,false,'54','54')  
sql insert into tb6 values ('2021-05-05 18:19:24',61,61.0,61,61,61,61.0,true ,'61','61')
sql insert into tb6 values ('2021-05-05 18:19:25',62,62.0,62,62,62,62.0,true ,'62','62')
sql insert into tb6 values ('2021-05-05 18:19:26',63,63.0,63,63,63,63.0,false,'63','63')
sql insert into tb6 values ('2021-05-05 18:19:27',64,64.0,64,64,64,64.0,false,'64','64')

sleep 100

print "column test"
sql select * from stb1 where c1 > 0
if $rows != 28 then
  return -1
endi
#sql select * from stb1 where c1 > 0 and c1 > 3
#sql select * from stb1 where c1 > 0 or c1 > 3
#sql select * from stb1 where c1 > 0 and c1 > 3 and c1 < 2
#sql select * from stb1 where c1 > 0 or c1 > 3 or c1 < 1
#sql select * from stb1 where c1 > 0 and c1 > 3 or c1 < 1
#sql select * from stb1 where c1 > 0 or c1 > 3 and c1 < 1
#sql select * from stb1 where c1 > 0 and c1 > 3 and c1 < 1 and c1 > 4
#sql select * from stb1 where c1 > 0 and c1 > 3 and c1 < 1 or c1 > 4
#sql select * from stb1 where c1 > 0 and c1 > 3 or c1 < 1 and c1 > 4
#sql select * from stb1 where c1 > 0 or c1 > 3 and c1 < 1 and c1 > 4
#sql select * from stb1 where c1 > 0 and c1 > 3 or c1 < 1 or c1 > 4
#sql select * from stb1 where c1 > 0 or c1 > 3 and c1 < 1 or c1 > 4
#sql select * from stb1 where c1 > 0 or c1 > 3 or c1 < 1 and c1 > 4
#sql select * from stb1 where c1 > 0 or c1 > 3 or c1 < 1 or c1 > 4
#
#sql select * from stb1 where (c1 > 0 and c1 > 3) and c1 < 2
#sql select * from stb1 where c1 > 0 and (c1 > 3 and c1 < 2)
#sql select * from stb1 where (c1 > 0 or c1 > 3) or c1 < 1
#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1)
#sql select * from stb1 where (c1 > 0 and c1 > 3) or c1 < 1
#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1)
#sql select * from stb1 where (c1 > 0 or c1 > 3) and c1 < 1
#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1)
#sql select * from stb1 where (c1 > 0 and c1 > 3) and (c1 < 1 and c1 > 4)
#sql select * from stb1 where (c1 > 0 and c1 > 3 and c1 < 1) and c1 > 4
#sql select * from stb1 where c1 > 0 and (c1 > 3 and c1 < 1) and c1 > 4
#sql select * from stb1 where c1 > 0 and (c1 > 3 and c1 < 1 or c1 > 4)
#sql select * from stb1 where (c1 > 0 and c1 > 3) or (c1 < 1 and c1 > 4)
#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1) and c1 > 4
#sql select * from stb1 where (c1 > 0 and c1 > 3 or c1 < 1) and c1 > 4
#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1 and c1 > 4)
#sql select * from stb1 where (c1 > 0 or c1 > 3) and (c1 < 1 and c1 > 4)
#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1 and c1 > 4)
#sql select * from stb1 where (c1 > 0 or c1 > 3 and c1 < 1) and c1 > 4
#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1) and c1 > 4
#sql select * from stb1 where (c1 > 0 and c1 > 3) or (c1 < 1 or c1 > 4)
#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1 or c1 > 4)
#sql select * from stb1 where (c1 > 0 and c1 > 3 or c1 < 1) or c1 > 4
#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1) or c1 > 4
#sql select * from stb1 where (c1 > 0 or c1 > 3) and (c1 < 1 or c1 > 4)
#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1 or c1 > 4)
#sql select * from stb1 where (c1 > 0 or c1 > 3 and c1 < 1) or c1 > 4
#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1) or c1 > 4
#sql select * from stb1 where (c1 > 0 or c1 > 3) or (c1 < 1 and c1 > 4)
#sql select * from stb1 where (c1 > 0 or c1 > 3 or c1 < 1) and c1 > 4
#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1 and c1 > 4)
#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1) and c1 > 4
#sql select * from stb1 where (c1 > 0 or c1 > 3) or (c1 < 1 or c1 > 4)
#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1 or c1 > 4)
#sql select * from stb1 where (c1 > 0 or c1 > 3 or c1 < 1) or c1 > 4
#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1) or c1 > 4

sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5
D
dapan1121 已提交
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
if $rows != 3 then
  return -1
endi
if $data00 != @21-05-05 18:19:01.000@ then
  return -1
endi
if $data01 != 2 then
  return -1
endi
if $data10 != @21-05-05 18:19:02.000@ then
  return -1
endi
if $data11 != 3 then
  return -1
endi
if $data20 != @21-05-05 18:19:03.000@ then
  return -1
endi
if $data21 != 4 then
  return -1
endi

sql select * from stb1 where (c1 > 52 or c1 < 10) and (c2 > 1 and c2 < 61)
if $rows != 5 then
  return -1
endi
if $data00 != @21-05-05 18:19:01.000@ then
  return -1
endi
if $data01 != 2 then
  return -1
endi
if $data10 != @21-05-05 18:19:02.000@ then
  return -1
endi
if $data11 != 3 then
  return -1
endi
if $data20 != @21-05-05 18:19:03.000@ then
  return -1
endi
if $data21 != 4 then
  return -1
endi
if $data30 != @21-05-05 18:19:22.000@ then
  return -1
endi
if $data31 != 53 then
  return -1
endi
if $data40 != @21-05-05 18:19:23.000@ then
  return -1
endi
if $data41 != 54 then
  return -1
endi
D
dapan1121 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254


print "ts test"

print "tbname test"

print "tag test"

print "join test"




print "column&ts test"

print "column&tbname test"



print "column&tag test"
#sql_error select * from stb1 where t1 > 0 or c1 > 0
#sql_error select * from stb1 where c1 > 0 or t1 > 0
#sql_error select * from stb1 where t1 > 0 or c1 > 0 or t1 > 1
#sql_error select * from stb1 where c1 > 0 or t1 > 0 or c1 > 1
#sql_error select * from stb1 where t1 > 0 and c1 > 0 or t1 > 1
#sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1
#sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1
#sql_error select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1
#sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3)
#sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1
#
#
#sql select * from stb1 where c1 > 0 and t1 > 0
#sql select * from stb1 where t1 > 0 and c1 > 0
#sql select * from stb1 where t1 > 0 and t1 > 3 and c1 > 1
#sql select * from stb1 where t1 > 0 and c1 > 0 and t1 > 1
#sql select * from stb1 where c1 > 0 and t1 > 0 and c1 > 1
#sql select * from stb1 where c1 > 0 and (t1 > 0 or t1 > 1)
#sql select * from stb1 where (t1 > 0 or t1 > 2 ) and (c1 > 1 or c1 > 3)
#sql select * from stb1 where c1 > 0 and (t1 > 0 or t1 > 1)

print "column&join test"

print "ts&tbname test"

print "ts&tag test"

print "ts&join test"

print "tbname&tag test"

print "tbname&join test"

print "tag&join test"





print "column&ts&tbname test"

print "column&ts&tag test"

print "column&ts&join test"

print "column&tbname&tag test"

print "column&tbname&join test"
print "column&tag&join test"
print "ts&tbname&tag test"
print "ts&tbname&join test"
print "ts&tag&join test"
print "tbname&tag&join test"




print "column&ts&tbname&tag test"
print "column&ts&tbname&join test"
print "column&ts&tag&join test"
print "column&tbname&tag&join test"
print "ts&tbname&tag&join test"


print "column&ts&tbname&tag&join test"

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