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 interp from table
$tb = $tbPrefix . 0
## interp(*) from tb
sql_error select interp(*) from $tb where ts = $ts0

## interp + limit offset
sql_error select interp(*) from $tb where ts = $ts0 limit 5 offset 1

sql_error 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

## 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
sql_error select interp(ts) from $tb where ts=$ts0 interval(1s)

### 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_error 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)
sql_error 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)

sql_error 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)

## fill(NULL)
$t = $tsu - 1000
sql_error 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

$t = $tsu + 1000
sql_error 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)

## fill(prev)
$t = $ts0 + 1000
sql_error 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)

sql_error 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)

$t = $ts0 - 1000
sql_error 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)

$t = $ts0 + 1000
sql_error 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)

$t = $tsu + 1000
sql_error 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)

## fill(linear)
$t = $ts0 + 1000
sql_error 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)

# columns contain NULL values
$t = $ts0 + 1000
sql_error 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 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_error 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)

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_error 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)

$t = $ts0 - 1000
sql_error 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)

$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_error 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)

## fill(value)
$t = $ts0 + 1000
print 91
sql_error 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)

sql_error 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)

# table has NULL columns
sql_error 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)

$t = $ts0 - 1000
sql_error 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)

$t = $tsu + 1000
sql_error 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)

### select interp from stable
## interp(*) from stb
print select interp(*) from $stb where ts = $ts0
sql_error select interp(*) from $stb where ts = $ts0

sql_error select interp(*) from $stb where ts = $t

## interp(*) from stb + group by
sql_error 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

## interp(*) from stb + group by + limit offset
sql_error select interp(*) from $stb where ts = $ts0 group by tbname limit 0

sql_error 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_error select interp(*) from $stb where ts = $t fill(none) group by tbname

sql_error select interp(*) from $stb where ts = $ts0 fill(none) group by tbname

## interp(*) from stb + group by + fill(none)
$t = $ts0 + 1000
sql_error select interp(*) from $stb where ts = $t fill(NULL) group by tbname

sql_error select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname
print $rows

## interp(*) from stb + group by + fill(prev)
$t = $ts0 + 1000
sql_error select interp(*) from $stb where ts = $t fill(prev) group by tbname

## interp(*) from stb + group by + fill(linear)
$t = $ts0 + 1000
sql_error select interp(*) from $stb where ts = $t fill(linear) group by tbname

  ## interp(*) from stb + group by + fill(value)
$t = $ts0 + 1000
sql_error select interp(*) from $stb where ts = $t fill(value, -1, -2) group by tbname

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_error select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12' every(1s) fill(linear);

sql_error select interp(c1) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m);

sql_error 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' every(18m) fill(linear)

sql_error select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear);

sql_error select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear) order by ts desc;

sql_error  select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(2m) fill(linear) order by ts;

sql_error select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts;

sql_error select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts desc;

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(value, 1);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(NULL);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(value, 1);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(null);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(linear);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(prev);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(next);

sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:07' every(1s);

