null.sim 11.1 KB
Newer Older
P
plum-lihui 已提交
1 2 3 4 5 6 7 8 9
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 d0
sql show databases
10
if $rows != 3 then
P
plum-lihui 已提交
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
  return -1
endi

print $data00 $data01 $data02

sql use d0

print =============== create super table, include column type for count/sum/min/max/first
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double, c4 bigint) tags (t1 int unsigned)

sql show stables
if $rows != 1 then 
  return -1
endi

print =============== create child table
sql create table ct1 using stb tags(1000)
sql create table ct2 using stb tags(2000)
sql create table ct3 using stb tags(3000)

sql show tables
if $rows != 3 then 
  return -1
endi

print =============== insert data, include NULL
sql insert into ct1 values (now+0s, 10, 2.0, 3.0, 90)(now+1s, NULL, NULL, NULL, NULL)(now+2s, NULL, 2.1, 3.1, 91)(now+3s, 11, NULL, 3.2, 92)(now+4s, 12, 2.2, NULL, 93)(now+5s, 13, 2.3, 3.3, NULL)
sql insert into ct1 values (now+6s, NULL, 2.4, 3.4, 94)
sql insert into ct1 values (now+7s, 14, NULL, 3.5, 95)
sql insert into ct1 values (now+8s, 15, 2.5, NULL, 96)
sql insert into ct1 values (now+9s, 16, 2.6, 3.6, NULL)
sql insert into ct1 values (now+10s, NULL, NULL, NULL, NULL)
P
plum-lihui 已提交
43
sql insert into ct1 values (now+11s, -2147483647, 2.7, 3.7, 97)
P
plum-lihui 已提交
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

#===================================================================
#===================================================================
print =============== query data from child table
sql select * from ct1
print ===> select * from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
print ===> rows1: $data10 $data11 $data12 $data13 $data14
print ===> rows2: $data20 $data21 $data22 $data23 $data24
print ===> rows3: $data30 $data31 $data32 $data33 $data34
print ===> rows4: $data40 $data41 $data42 $data43 $data44
if $rows != 12 then
  return -1
endi
if $data01 != 10 then 
  return -1
endi
if $data02 != 2.00000 then 
  return -1
endi
if $data03 != 3.000000000 then 
  return -1
endi
#if $data41 != -14 then 
#  return -1
#endi
#if $data42 != -2.40000 then 
#  return -1
#endi
#if $data43 != -3.400000000 then 
#  return -1
#endi

print =============== select count(*) from child table
sql select count(*) from ct1
print ===> select count(*) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
86
if $data00 != 12 then 
P
plum-lihui 已提交
87 88 89 90 91 92 93 94
  return -1
endi

print =============== select count(column) from child table
sql select count(ts), count(c1), count(c2), count(c3) from ct1
print ===> select count(ts), count(c1), count(c2), count(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
P
plum-lihui 已提交
95
if $data00 != 12 then 
P
plum-lihui 已提交
96 97
  return -1
endi
P
plum-lihui 已提交
98
if $data01 != 8 then 
P
plum-lihui 已提交
99 100
  return -1
endi
P
plum-lihui 已提交
101
if $data02 != 8 then 
P
plum-lihui 已提交
102 103
  return -1
endi
P
plum-lihui 已提交
104
if $data03 != 8 then 
P
plum-lihui 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
  return -1
endi

#print =============== select first(*)/first(column) from child table
#sql select first(*) from ct1
#sql select first(ts), first(c1), first(c2), first(c3) from ct1

print =============== select min(column) from child table
sql select min(c1), min(c2), min(c3) from ct1
print ===> select min(c1), min(c2), min(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
120
if $data00 != -2147483647 then 
P
plum-lihui 已提交
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
  return -1
endi
if $data01 != 2.00000 then 
  return -1
endi
if $data02 != 3.000000000 then 
  return -1
endi

print =============== select max(column) from child table
sql select max(c1), max(c2), max(c3) from ct1
print ===> select max(c1), max(c2), max(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
138
if $data00 != 16 then 
P
plum-lihui 已提交
139 140
  return -1
endi
P
plum-lihui 已提交
141
if $data01 != 2.70000 then 
P
plum-lihui 已提交
142 143
  return -1
endi
P
plum-lihui 已提交
144
if $data02 != 3.700000000 then 
P
plum-lihui 已提交
145 146 147 148 149 150 151 152 153 154 155
  return -1
endi

print =============== select sum(column) from child table
sql select sum(c1), sum(c2), sum(c3) from ct1
print ===> select sum(c1), sum(c2), sum(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
156
if $data00 != -2147483556  then 
P
plum-lihui 已提交
157 158
  return -1
endi
P
plum-lihui 已提交
159
if $data01 != 18.799999952 then 
P
plum-lihui 已提交
160 161
  return -1
endi
P
plum-lihui 已提交
162
if $data02 != 26.800000000 then 
P
plum-lihui 已提交
163 164 165 166 167 168 169 170
  return -1
endi

print =============== select column, from child table
sql select c1, c2, c3 from ct1
print ===> select c1, c2, c3 from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
P
plum-lihui 已提交
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
if $rows != 12 then 
  return -1
endi
if $data00 != 10 then 
  return -1
endi
if $data01 != 2.00000 then 
  return -1
endi
if $data02 != 3.000000000 then 
  return -1
endi
if $data10 != NULL then 
  return -1
endi
if $data11 != NULL then 
  return -1
endi
if $data12 != NULL then 
  return -1
endi
if $data30 != 11 then 
  return -1
endi
if $data31 != NULL then 
  return -1
endi
if $data32 != 3.200000000 then 
  return -1
endi
if $data90 != 16 then 
  return -1
endi
if $data91 != 2.60000 then 
  return -1
endi
if $data92 != 3.600000000 then 
  return -1
endi
P
plum-lihui 已提交
210 211 212 213 214 215 216 217 218 219 220 221 222
#===================================================================
#===================================================================

#print =============== query data from stb
#sql select * from stb
#print ===> 
#print ===> rows: $rows
#print ===> rows0: $data00 $data01 $data02 $data03 $data04
#if $rows != 4 then 
#  return -1
#endi
#print =============== select count(*) from supter table
#sql select count(*) from stb
P
plum-lihui 已提交
223
#print $data00 $data01 $data02
P
plum-lihui 已提交
224 225 226
#if $rows != 1 then 
#  return -1
#endi
P
plum-lihui 已提交
227
#if $data00 != 12 then 
P
plum-lihui 已提交
228 229
#  return -1
#endi
P
plum-lihui 已提交
230

P
plum-lihui 已提交
231 232 233
#print =============== select count(column) from supter table
#sql select count(ts), count(c1), count(c2), count(c3) from stb
#print $data00 $data01 $data02  $data03
P
plum-lihui 已提交
234
#if $data00 != 12 then 
P
plum-lihui 已提交
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
#  return -1
#endi
#if $data01 != 8 then 
#  return -1
#endi
#if $data02 != 8 then 
#  return -1
#endi
#if $data03 != 8 then 
#  return -1
#endi

#===================================================================
#===================================================================

print =============== stop and restart taosd, then again do query above
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

P
plum-lihui 已提交
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
print ===> waiting dnode ready
$loop_cnt = 0
check_dnode_ready:
	$loop_cnt = $loop_cnt + 1
	sleep 200
	if $loop_cnt == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
  return -1
endi
if $data04 != ready then
  goto check_dnode_ready
endi

#===================================================================
#===================================================================
print =============== query data from child table
P
plum-lihui 已提交
275
sql select * from ct1
P
plum-lihui 已提交
276 277 278 279 280 281 282 283
print ===> select * from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
print ===> rows1: $data10 $data11 $data12 $data13 $data14
print ===> rows2: $data20 $data21 $data22 $data23 $data24
print ===> rows3: $data30 $data31 $data32 $data33 $data34
print ===> rows4: $data40 $data41 $data42 $data43 $data44
if $rows != 12 then
P
plum-lihui 已提交
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
  return -1
endi
if $data01 != 10 then 
  return -1
endi
if $data02 != 2.00000 then 
  return -1
endi
if $data03 != 3.000000000 then 
  return -1
endi
#if $data41 != -14 then 
#  return -1
#endi
#if $data42 != -2.40000 then 
#  return -1
#endi
#if $data43 != -3.400000000 then 
#  return -1
#endi

print =============== select count(*) from child table
sql select count(*) from ct1
P
plum-lihui 已提交
307 308 309
print ===> select count(*) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
P
plum-lihui 已提交
310 311 312
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
313
if $data00 != 12 then 
P
plum-lihui 已提交
314 315 316 317 318
  return -1
endi

print =============== select count(column) from child table
sql select count(ts), count(c1), count(c2), count(c3) from ct1
P
plum-lihui 已提交
319 320 321 322
print ===> select count(ts), count(c1), count(c2), count(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
if $data00 != 12 then 
P
plum-lihui 已提交
323 324
  return -1
endi
P
plum-lihui 已提交
325
if $data01 != 8 then 
P
plum-lihui 已提交
326 327
  return -1
endi
P
plum-lihui 已提交
328
if $data02 != 8 then 
P
plum-lihui 已提交
329 330
  return -1
endi
P
plum-lihui 已提交
331
if $data03 != 8 then 
P
plum-lihui 已提交
332 333 334 335 336 337 338 339 340
  return -1
endi

#print =============== select first(*)/first(column) from child table
#sql select first(*) from ct1
#sql select first(ts), first(c1), first(c2), first(c3) from ct1

print =============== select min(column) from child table
sql select min(c1), min(c2), min(c3) from ct1
P
plum-lihui 已提交
341 342 343
print ===> select min(c1), min(c2), min(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
P
plum-lihui 已提交
344 345 346
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
347
if $data00 != -2147483647 then 
P
plum-lihui 已提交
348 349 350 351 352 353 354 355 356 357 358
  return -1
endi
if $data01 != 2.00000 then 
  return -1
endi
if $data02 != 3.000000000 then 
  return -1
endi

print =============== select max(column) from child table
sql select max(c1), max(c2), max(c3) from ct1
P
plum-lihui 已提交
359 360 361
print ===> select max(c1), max(c2), max(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
P
plum-lihui 已提交
362 363 364
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
365
if $data00 != 16 then 
P
plum-lihui 已提交
366 367
  return -1
endi
P
plum-lihui 已提交
368
if $data01 != 2.70000 then 
P
plum-lihui 已提交
369 370
  return -1
endi
P
plum-lihui 已提交
371
if $data02 != 3.700000000 then 
P
plum-lihui 已提交
372 373 374 375 376
  return -1
endi

print =============== select sum(column) from child table
sql select sum(c1), sum(c2), sum(c3) from ct1
P
plum-lihui 已提交
377 378 379
print ===> select sum(c1), sum(c2), sum(c3) from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
P
plum-lihui 已提交
380 381 382
if $rows != 1 then 
  return -1
endi
P
plum-lihui 已提交
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
if $data00 != -2147483556  then 
  return -1
endi
if $data01 != 18.799999952 then 
  return -1
endi
if $data02 != 26.800000000 then 
  return -1
endi

print =============== select column, from child table
sql select c1, c2, c3 from ct1
print ===> select c1, c2, c3 from ct1
print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04
if $rows != 12 then 
  return -1
endi
if $data00 != 10 then 
  return -1
endi
if $data01 != 2.00000 then 
  return -1
endi
if $data02 != 3.000000000 then 
  return -1
endi
if $data10 != NULL then 
  return -1
endi
if $data11 != NULL then 
  return -1
endi
if $data12 != NULL then 
  return -1
endi
if $data30 != 11 then 
  return -1
endi
if $data31 != NULL then 
P
plum-lihui 已提交
423 424
  return -1
endi
P
plum-lihui 已提交
425
if $data32 != 3.200000000 then 
P
plum-lihui 已提交
426 427
  return -1
endi
P
plum-lihui 已提交
428
if $data90 != 16 then 
P
plum-lihui 已提交
429 430
  return -1
endi
P
plum-lihui 已提交
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
if $data91 != 2.60000 then 
  return -1
endi
if $data92 != 3.600000000 then 
  return -1
endi
#===================================================================
#===================================================================

#print =============== query data from stb
#sql select * from stb
#print ===> 
#print ===> rows: $rows
#print ===> rows0: $data00 $data01 $data02 $data03 $data04
#if $rows != 4 then 
#  return -1
#endi
#print =============== select count(*) from supter table
#sql select count(*) from stb
#print $data00 $data01 $data02
#if $rows != 1 then 
#  return -1
#endi
#if $data00 != 12 then 
#  return -1
#endi

#print =============== select count(column) from supter table
#sql select count(ts), count(c1), count(c2), count(c3) from stb
#print $data00 $data01 $data02  $data03
#if $data00 != 12 then 
#  return -1
#endi
#if $data01 != 8 then 
#  return -1
#endi
#if $data02 != 8 then 
#  return -1
#endi
#if $data03 != 8 then 
#  return -1
#endi
P
plum-lihui 已提交
473

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