sleep 100 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 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) ### 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 ## fill(NULL) $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 if $data01 != NULL then print expect NULL, actual $data01 return -1 endi if $data02 != NULL then return -1 endi if $data03 != NULL then return -1 endi if $data04 != NULL then return -1 endi if $data05 != NULL then return -1 endi if $data06 != NULL 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 $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 if $data02 != NULL then return -1 endi if $data03 != 0.00000 then print expect 0.00000, actual:$data03 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 if $data07 != NULL then return -1 endi if $data08 != NULL then return -1 endi if $data09 != NULL then 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 if $data02 != NULL then return -1 endi if $data03 != 0.00167 then return -1 endi if $data04 != NULL 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 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) 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 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) 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 if $data02 != NULL then return -1 endi if $data03 != 0.00000 then return -1 endi if $data04 != NULL 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(linear) if $rows != 0 then return -1 endi $t = $tsu + 1000 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) 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 print 91 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 if $data08 != NULL then return -1 endi if $data09 != NULL 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(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 # table has NULL columns 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 if $data02 != NULL then return -1 endi if $data03 != 0.00000 then return -1 endi if $data04 != NULL 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(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 print select interp(*) from $stb where ts = $ts0 sql select interp(*) from $stb where ts = $ts0 if $rows != 1 then return -1 endi $t = $ts0 + 1000 print 92 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 if $data22 != NULL then return -1 endi if $data24 != NULL then 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 if $data22 != NULL then return -1 endi if $data24 != NULL then return -1 endi ## interp(*) from stb + group by + fill(none) $t = $ts0 + 1000 sql select interp(*) from $stb where ts = $t fill(NULL) group by tbname if $rows != $tbNum then return -1 endi if $data00 != @18-09-17 09:00:01.000@ then return -1 endi if $data01 != NULL then return -1 endi if $data12 != NULL then return -1 endi if $data23 != NULL then return -1 endi if $data34 != NULL then return -1 endi if $data05 != NULL then return -1 endi if $data16 != NULL then return -1 endi if $data27 != NULL then return -1 endi if $data38 != NULL then return -1 endi if $data09 != NULL then return -1 endi sql select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname 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 if $data22 != NULL then return -1 endi if $data24 != NULL then return -1 endi ## 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 ## 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 ## 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