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

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);
if $rows != 1 then
  return -1
endi

if $data00 != @18-11-25 18:30:00.000@ then
  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

if $data00 != @18-11-25 17:54:00.000@  then
  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

if $data04 != @18-11-25 17:54:00.000@ then
  return -1
endi

if $data10 != @18-11-25 18:12:00.000@ then
  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

if $data14 != @18-11-25 18:12:00.000@ then
  return -1
endi

if $data40 != @18-11-25 19:06:00.000@ then
  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

if $data44 != @18-11-25 19:06:00.000@ then
  return -1
endi







sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' interval(1s) fill(linear);
if $rows != 6 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.50000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.50000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.87500 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' interval(1s) fill(value, 1);
if $rows != 6 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 1.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 1.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 1.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 1.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 1.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' interval(1s) fill(NULL);
if $rows != 6 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != NULL then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != NULL then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != NULL then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != NULL then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != NULL then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' interval(1s) fill(prev);
if $rows != 6 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' interval(1s) fill(next);
if $rows != 6 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 5.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 8.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 10.00000 then
  return -1
endi


sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' interval(1s) fill(linear);
if $rows != 0 then
  return -1
endi
sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' interval(1s) fill(prev);
if $rows != 2 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' interval(1s) fill(next);
if $rows != 2 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != NULL then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' interval(1s) fill(linear);
if $rows != 3 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' interval(1s) fill(prev);
if $rows != 3 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' interval(1s) fill(next);
if $rows != 3 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' interval(1s) fill(linear);
if $rows != 10 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.50000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.50000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.87500 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != NULL then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != NULL then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != NULL then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != NULL then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' interval(1s) fill(prev);
if $rows != 10 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 14.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 14.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 14.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' interval(1s) fill(next);
if $rows != 10 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 5.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 8.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 10.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != NULL then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != NULL then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != NULL then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != NULL then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' interval(1s) fill(linear);
if $rows != 12 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.50000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.50000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.87500 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.11765 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 15.29412 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' interval(1s) fill(prev);
if $rows != 12 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 14.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 14.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 14.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' interval(1s) fill(next);
if $rows != 12 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 5.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 8.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 10.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 20.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 20.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 20.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 20.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' interval(1s) fill(value, 1);
if $rows != 4 then
  return -1
endi
if $data00 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data11 != 1.00000 then
  return -1
endi
if $data20 != @21-07-25 02:20:04.000@  then
  return -1
endi
if $data21 != 1.00000 then
  return -1
endi
if $data30 != @21-07-25 02:20:05.000@  then
  return -1
endi
if $data31 != 20.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' interval(1s) fill(null);
if $rows != 4 then
  return -1
endi
if $data00 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data11 != NULL then
  return -1
endi
if $data20 != @21-07-25 02:20:04.000@  then
  return -1
endi
if $data21 != NULL then
  return -1
endi
if $data30 != @21-07-25 02:20:05.000@  then
  return -1
endi
if $data31 != 20.00000 then
  return -1
endi


sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' interval(1s) fill(linear);
if $rows != 32 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.50000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.50000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.87500 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.11765 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 15.29412 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' interval(1s) fill(prev);
if $rows != 32 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 14.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 14.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 14.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' interval(1s) fill(next);
if $rows != 32 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 5.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 8.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 10.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 20.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 20.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 20.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 20.00000 then
  return -1
endi


sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' interval(1s) fill(linear);
if $rows != 307 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.50000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.50000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.87500 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.11765 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 15.29412 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' interval(1s) fill(prev);
if $rows != 307 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 14.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 14.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 14.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' interval(1s) fill(next);
if $rows != 307 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 5.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 8.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 10.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 20.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 20.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 20.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 20.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' interval(1s) fill(linear);
if $rows != 3907 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.31818 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.77273 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.50000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.50000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.87500 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.11765 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 15.29412 then
  return -1
endi


sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' interval(1s) fill(prev);
if $rows != 3907 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != NULL  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 3.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 3.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 4.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 7.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 9.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 14.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 14.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 14.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 14.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' interval(1s) fill(next);
if $rows != 3907 then
  return -1
endi
if $data00 != @21-07-25 02:19:54.000@  then
  return -1
endi
if $data01 != 1.00000  then
  return -1
endi
if $data10 != @21-07-25 02:19:55.000@  then
  return -1
endi
if $data11 != 4.00000 then
  return -1
endi
if $data20 != @21-07-25 02:19:56.000@  then
  return -1
endi
if $data21 != 4.00000 then
  return -1
endi
if $data30 != @21-07-25 02:19:57.000@  then
  return -1
endi
if $data31 != 5.00000 then
  return -1
endi
if $data40 != @21-07-25 02:19:58.000@  then
  return -1
endi
if $data41 != 8.00000 then
  return -1
endi
if $data50 != @21-07-25 02:19:59.000@  then
  return -1
endi
if $data51 != 10.00000 then
  return -1
endi
if $data60 != @21-07-25 02:20:00.000@  then
  return -1
endi
if $data61 != 20.00000 then
  return -1
endi
if $data70 != @21-07-25 02:20:01.000@  then
  return -1
endi
if $data71 != 20.00000 then
  return -1
endi
if $data80 != @21-07-25 02:20:02.000@  then
  return -1
endi
if $data81 != 20.00000 then
  return -1
endi
if $data90 != @21-07-25 02:20:03.000@  then
  return -1
endi
if $data91 != 20.00000 then
  return -1
endi

sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:07' interval(1s);
if $rows != 1 then
  return -1
endi
if $data00 != @21-07-25 02:20:05.000@  then
  return -1
endi
if $data01 != 20.00000  then
  return -1
endi

