interp_test.sim 20.2 KB
Newer Older
H
Haojun Liao 已提交
1
sleep 100
S
slguan 已提交
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
sql connect

$dbPrefix = intp_db
$tbPrefix = intp_tb
$stbPrefix = intp_stb
$tbNum = 4
$rowNum = 10000
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== intp_test.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i
$tsu = $rowNum * $delta
$tsu = $tsu - $delta
$tsu = $tsu + $ts0

print ====== use db
sql use $db

##### select interp from table
print ====== select intp from table
$tb = $tbPrefix . 0
  ## interp(*) from tb
  sql select interp(*) from $tb where ts = $ts0
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi

  ## interp + limit offset
  sql select interp(*) from $tb where ts = $ts0 limit 5 offset 1
  if $rows != 0 then
    return -1
  endi

  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi
  if $data03 != 0.00000 then
    return -1
  endi
  if $data04 != 0.000000000 then
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
  if $data07 != 1 then
    return -1
  endi
  if $data08 != binary0 then
    return -1
  endi
  if $data09 != nchar0 then
    return -1
  endi

  ## intp + aggregation functions
  #$t = $ts0 + $delta
  #$t = $t + $delta
  #sql_error select interp(ts), max(c1), min(c2), count(c3), sum(c4), avg(c5), stddev(c6), first(c7), last(c8), interp(c9) from $tb where ts = $t

  ### illegal queries on a table
  sql_error select interp(ts), c1 from $tb where ts = $ts0
  sql_error select interp(ts) from $tb where ts >= $ts0
90
  sql_error select interp(ts), max(c1), min(c2), count(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(NULL)
S
slguan 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

  ### interp from tb + fill
  $t = $ts0 + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t
  if $rows != 0 then
    return -1
  endi

  ## fill(none)
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none)
  if $rows != 0 then
    return -1
  endi
  $t = $tsu + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none)
  if $rows != 0 then
    return -1
  endi

110
  ## fill(NULL)
S
slguan 已提交
111 112 113 114 115 116 117 118
  $t = $tsu - 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, NULL) order by ts asc
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-11-25 19:29:59.000@ then
    return -1
  endi
119
  if $data01 != NULL then
120
    print expect NULL, actual $data01
S
slguan 已提交
121 122
    return -1
  endi
123
  if $data02 != NULL then
S
slguan 已提交
124 125
    return -1
  endi
126
  if $data03 != NULL then
S
slguan 已提交
127 128
    return -1
  endi
129
  if $data04 != NULL then
S
slguan 已提交
130 131
    return -1
  endi
132
  if $data05 != NULL then
S
slguan 已提交
133 134
    return -1
  endi
135
  if $data06 != NULL then
S
slguan 已提交
136 137
    return -1
  endi
138
  if $data07 != NULL then
S
slguan 已提交
139 140
    return -1
  endi
141
  if $data08 != NULL then
S
slguan 已提交
142 143
    return -1
  endi
144
  if $data09 != NULL then
S
slguan 已提交
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
    return -1
  endi

  $t = $tsu + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none)
  if $rows != 0 then
    return -1
  endi

  ## fill(prev)
  $t = $ts0 + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev)
  if $rows != 1 then
    return -1
  endi

  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(prev)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi
  if $data03 != 0.00000 then
    return -1
  endi
  if $data04 != 0.000000000 then
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
  if $data07 != 1 then
    return -1
  endi
  if $data08 != binary0 then
    return -1
  endi
  if $data09 != nchar0 then
    return -1
  endi

  $t = $ts0 - 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev)
  if $rows != 0 then
    return -1
  endi

  $t = $ts0 + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(prev)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:01.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
213
  if $data02 != NULL then
S
slguan 已提交
214 215 216
    return -1
  endi
  if $data03 != 0.00000 then
217
    print expect 0.00000, actual:$data03
S
slguan 已提交
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 255 256 257 258
    return -1
  endi
#  if $data04 != NULL then
#    return -1
#  endi

  $t = $tsu + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev)
  if $rows != 0 then
    return -1
  endi

  ## fill(linear)
  $t = $ts0 + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear)
  print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:01.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi
  print $data03
  if $data03 != 0.00167 then
    return -1
  endi
  if $data04 != 0.001666667 then
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
259
  if $data07 != NULL then
S
slguan 已提交
260 261
    return -1
  endi
262
  if $data08 != NULL then
S
slguan 已提交
263 264
    return -1
  endi
265
  if $data09 != NULL then
S
slguan 已提交
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
    return -1
  endi
  # columns contain NULL values
  $t = $ts0 + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(linear)
  print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:01.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
281
  if $data02 != NULL then
S
slguan 已提交
282 283 284 285 286
    return -1
  endi
  if $data03 != 0.00167 then
    return -1
  endi
287
  if $data04 != NULL then
S
slguan 已提交
288 289 290 291 292 293 294 295
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
296
  if $data07 != NULL then
S
slguan 已提交
297 298
    return -1
  endi
299
  if $data08 != NULL then
S
slguan 已提交
300 301
    return -1
  endi
302
  if $data09 != NULL then
S
slguan 已提交
303 304 305
    return -1
  endi

H
Haojun Liao 已提交
306 307
  print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear)

S
slguan 已提交
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi
  if $data03 != 0.00000 then
    return -1
  endi
  if $data04 != 0.000000000 then
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
  if $data07 != 1 then
    return -1
  endi
  if $data08 != binary0 then
    return -1
  endi
  if $data09 != nchar0 then
    return -1
  endi
  # columns contain NULL values
H
Haojun Liao 已提交
343 344

  print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear)
S
slguan 已提交
345 346 347 348 349 350 351 352 353 354
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
355
  if $data02 != NULL then
S
slguan 已提交
356 357 358 359 360
    return -1
  endi
  if $data03 != 0.00000 then
    return -1
  endi
361
  if $data04 != NULL then
S
slguan 已提交
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
  if $data07 != 1 then
    return -1
  endi
  if $data08 != binary0 then
    return -1
  endi
  if $data09 != nchar0 then
    return -1
  endi

  $t = $ts0 - 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear)
  if $rows != 0 then
    return -1
  endi

  $t = $tsu + 1000
H
Haojun Liao 已提交
387
  print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear)
S
slguan 已提交
388 389 390 391 392 393 394
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear)
  if $rows != 0 then
    return -1
  endi

## fill(value)
  $t = $ts0 + 1000
H
Haojun Liao 已提交
395
  print 91
S
slguan 已提交
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 423
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:01.000@ then
    return -1
  endi
  if $data01 != -2 then
    return -1
  endi
  if $data02 != -2 then
    return -1
  endi
  if $data03 != -2.00000 then
    return -1
  endi
  if $data04 != -2.000000000 then
    return -1
  endi
  if $data05 != -2 then
    return -1
  endi
  if $data06 != -2 then
     return -1
  endi
  if $data07 != 1 then
    return -1
  endi
424
  if $data08 != NULL then
S
slguan 已提交
425 426
    return -1
  endi
427
  if $data09 != NULL then
S
slguan 已提交
428 429 430 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
    return -1
  endi

  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(value, -1, -2, -3)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi
  if $data03 != 0.00000 then
    return -1
  endi
  if $data04 != 0.000000000 then
    return -1
  endi
  if $data05 != 0 then
    return -1
  endi
  if $data06 != 0 then
     return -1
  endi
  if $data07 != 1 then
    return -1
  endi
  if $data08 != binary0 then
    return -1
  endi
  if $data09 != nchar0 then
    return -1
  endi
H
Haojun Liao 已提交
465

466
  # table has NULL columns
S
slguan 已提交
467 468 469 470 471 472 473 474 475 476
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(value, -1, -2, -3)
  if $rows != 1 then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
477
  if $data02 != NULL then
S
slguan 已提交
478 479 480 481 482
    return -1
  endi
  if $data03 != 0.00000 then
    return -1
  endi
483
  if $data04 != NULL then
S
slguan 已提交
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
    return -1
  endi

  $t = $ts0 - 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2)
  if $rows != 0 then
    return -1
  endi

  $t = $tsu + 1000
  sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2)
  if $rows != 0 then
    return -1
  endi

##### select interp from stable
  ## interp(*) from stb
H
Haojun Liao 已提交
501
  print select interp(*) from $stb where ts = $ts0
S
slguan 已提交
502 503 504 505 506
  sql select interp(*) from $stb where ts = $ts0
  if $rows != 1 then
    return -1
  endi
  $t = $ts0 + 1000
H
Haojun Liao 已提交
507 508
  print 92

S
slguan 已提交
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
  sql select interp(*) from $stb where ts = $t
  if $rows != 0 then
    return -1
  endi
  ## interp(*) from stb + group by 
  sql select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc
  print ====== select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc
  print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09
  print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29
  if $rows != $tbNum then
    return -1
  endi
  if $data00 != @18-09-17 09:00:00.000@ then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1 
  endi
  if $data04 != 0.000000000 then
    return -1
  endi
  if $data08 != intp_tb0 then
    return -1 
  endi
536
  if $data22 != NULL then
S
slguan 已提交
537 538
    return -1
  endi
539
  if $data24 != NULL then
S
slguan 已提交
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
    return -1
  endi
  if $data28 != intp_tb2 then
    return -1 
  endi

  ## interp(*) from stb + group by + limit offset
  sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0
  if $rows != 0 then
    return -1
  endi
  sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 offset 1

  ## interp(*) from stb + group by + fill(none)
  $t = $ts0 + 1000
  sql select interp(*) from $stb where ts = $t fill(none) group by tbname
  if $rows != 0 then
    return -1
  endi

  sql select interp(*) from $stb where ts = $ts0 fill(none) group by tbname
  if $rows != 4 then
    return -1
  endi
  if $data01 != 0 then
    return -1
  endi
  if $data02 != 0 then
    return -1
  endi
  if $data21 != 0 then
    return -1
  endi
573
  if $data22 != NULL then
S
slguan 已提交
574 575
    return -1
  endi
576
  if $data24 != NULL then
S
slguan 已提交
577 578 579 580 581
    return -1
  endi

  ## interp(*) from stb + group by + fill(none)
  $t = $ts0 + 1000
H
Haojun Liao 已提交
582
sql select interp(*) from $stb where ts = $t fill(NULL) group by tbname
S
slguan 已提交
583 584 585 586 587 588
if $rows != $tbNum then
  return -1
endi
if $data00 != @18-09-17 09:00:01.000@ then
  return -1
endi
589
if $data01 != NULL then
S
slguan 已提交
590 591
  return -1
endi
592
if $data12 != NULL then
S
slguan 已提交
593 594
  return -1
endi
595
if $data23 != NULL then
S
slguan 已提交
596 597
  return -1
endi
598
if $data34 != NULL then
S
slguan 已提交
599 600
  return -1
endi
601
if $data05 != NULL then
S
slguan 已提交
602 603
  return -1
endi
604
if $data16 != NULL then
S
slguan 已提交
605 606
  return -1
endi
607
if $data27 != NULL then
S
slguan 已提交
608 609
  return -1
endi
610
if $data38 != NULL then
S
slguan 已提交
611 612
  return -1
endi
613
if $data09 != NULL then
S
slguan 已提交
614 615 616
  return -1
endi

617
sql select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname
S
slguan 已提交
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
print $rows

if $rows != 4 then
  return -1
endi

if $data01 != 0 then
  return -1
endi

if $data02 != 0 then
  return -1
endi
if $data21 != 0 then
  return -1
endi
634
if $data22 != NULL then
S
slguan 已提交
635 636
  return -1
endi
637
if $data24 != NULL then
S
slguan 已提交
638 639 640
  return -1
endi

641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
## interp(*) from stb + group by + fill(prev)
$t = $ts0 + 1000
sql select interp(*) from $stb where ts = $t fill(prev) group by tbname
print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09
print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29
if $rows != $tbNum then
  return -1
endi
if $data00 != @18-09-17 09:00:01.000@ then
  return -1
endi
if $data01 != 0 then
  return -1
endi
if $data02 != 0 then
  return -1
endi
if $data03 != 0.00000 then
  return -1
endi
if $data04 != 0.000000000 then
  return -1
endi
if $data05 != 0 then
  return -1
endi
if $data06 != 0 then
   return -1
endi
if $data07 != 1 then
  return -1
endi
if $data08 != binary0 then
  return -1
endi
if $data09 != nchar0 then
  return -1
endi
if $data20 != @18-09-17 09:00:01.000@ then
  return -1
endi
if $data21 != 0 then
  return -1
endi
if $data22 != NULL then
  return -1
endi
if $data23 != 0.00000 then
  return -1
endi
if $data24 != NULL then
  return -1
endi
if $data25 != 0 then
  return -1
endi
if $data26 != 0 then
   return -1
endi
if $data27 != 1 then
  return -1
endi
if $data28 != binary0 then
  return -1
endi
if $data29 != nchar0 then
  return -1
endi
S
slguan 已提交
709

710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777
## interp(*) from stb + group by + fill(linear)
$t = $ts0 + 1000
sql select interp(*) from $stb where ts = $t fill(linear) group by tbname
print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09
print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29
if $rows != $tbNum then
  return -1
endi
if $data00 != @18-09-17 09:00:01.000@ then
  return -1
endi
if $data01 != 0 then
  return -1
endi
if $data02 != 0 then
  return -1
endi
if $data03 != 0.00167 then
  return -1
endi
if $data04 != 0.001666667 then
  return -1
endi
if $data05 != 0 then
  return -1
endi
if $data06 != 0 then
   return -1
endi
if $data07 != NULL then
  return -1
endi
if $data08 != NULL then
  return -1
endi
if $data09 != NULL then
  return -1
endi
if $data20 != @18-09-17 09:00:01.000@ then
  return -1
endi
if $data21 != 0 then
  return -1
endi
if $data22 != NULL then
  return -1
endi
if $data23 != 0.00167 then
  return -1
endi
if $data24 != NULL then
  return -1
endi
if $data25 != 0 then
  return -1
endi
if $data26 != 0 then
   return -1
endi
if $data27 != NULL then
  return -1
endi
if $data28 != NULL then
  return -1
endi
if $data29 != NULL then
  return -1
endi
S
slguan 已提交
778

779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
  ## interp(*) from stb + group by + fill(value)
$t = $ts0 + 1000
sql select interp(*) from $stb where ts = $t fill(value, -1, -2) group by tbname
print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09
print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29
if $rows != $tbNum then
  return -1
endi
if $data00 != @18-09-17 09:00:01.000@ then
  return -1
endi
if $data01 != -2 then
  return -1
endi
if $data02 != -2 then
  return -1
endi
if $data03 != -2.00000 then
  return -1
endi
if $data04 != -2.000000000 then
  return -1
endi
if $data05 != -2 then
  return -1
endi
if $data06 != -2 then
   return -1
endi
if $data07 != 1 then
  return -1
endi
if $data08 != NULL then
  return -1
endi
if $data09 != NULL then
  return -1
endi
if $data20 != @18-09-17 09:00:01.000@ then
  return -1
endi
if $data21 != -2 then
  return -1
endi
if $data22 != -2 then
  return -1
endi
if $data23 != -2.00000 then
  return -1
endi
if $data24 != -2.000000000 then
  return -1
endi
if $data25 != -2 then
  return -1
endi
if $data26 != -2 then
   return -1
endi
if $data27 != 1 then
  return -1
endi
if $data28 != NULL then
  return -1
endi
if $data29 != NULL then
  return -1
endi

sql_error select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12';
sql select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12' interval(1s) fill(linear);
if $rows != 0 then
  return -1
endi

sql select interp(c1) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' interval(18m);
H
Haojun Liao 已提交
855
if $rows != 1 then
856 857 858
  return -1
endi

H
Haojun Liao 已提交
859
if $data00 != @18-11-25 18:30:00.000@ then
860 861 862 863 864 865 866 867 868 869 870 871
  return -1
endi

if $data01 != 3 then
  return -1
endi

sql select interp(c1,c3,c4,ts) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' interval(18m) fill(linear)
if $rows != 5 then
  return -1
endi

H
Haojun Liao 已提交
872
if $data00 != @18-11-25 17:54:00.000@  then
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
  return -1
endi

if $data01 != 0 then
  return -1
endi

if $data02 != 0.00000 then
  return -1
endi

if $data03 != 0.000000000 then
  return -1
endi

H
Haojun Liao 已提交
888
if $data04 != @18-11-25 17:54:00.000@ then
889 890 891
  return -1
endi

H
Haojun Liao 已提交
892
if $data10 != @18-11-25 18:12:00.000@ then
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907
  return -1
endi

if $data11 != 1 then
  return -1
endi

if $data12 != 1.20000 then
  return -1
endi

if $data13 != 1.200000000 then
  return -1
endi

H
Haojun Liao 已提交
908
if $data14 != @18-11-25 18:12:00.000@ then
909 910 911
  return -1
endi

H
Haojun Liao 已提交
912
if $data40 != @18-11-25 19:06:00.000@ then
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927
  return -1
endi

if $data41 != 6 then
  return -1
endi

if $data42 != 6.60000 then
  return -1
endi

if $data43 != 6.600000000 then
  return -1
endi

H
Haojun Liao 已提交
928
if $data44 != @18-11-25 19:06:00.000@ then
929 930
  return -1
endi