提交 a68e772b 编写于 作者: S Shengliang Guan

TD-1530 invalid read while execute interp.sim

上级 b4472552
......@@ -1537,7 +1537,9 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* inputData, TSKEY
if (isNull((const char*) &pQuery->fillVal[colIndex], pCtx->inputType)) {
pCtx->param[1].nType = TSDB_DATA_TYPE_NULL;
} else { // todo refactor, tVariantCreateFromBinary should handle the NULL value
tVariantCreateFromBinary(&pCtx->param[1], (char*) &pQuery->fillVal[colIndex], pCtx->inputBytes, pCtx->inputType);
if(pCtx->inputType != TSDB_DATA_TYPE_BINARY && pCtx->inputType != TSDB_DATA_TYPE_NCHAR) {
tVariantCreateFromBinary(&pCtx->param[1], (char*) &pQuery->fillVal[colIndex], pCtx->inputBytes, pCtx->inputType);
}
}
}
}
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,9 @@ if $data00 != 9.500000000 then
endi
print =============== step3
sql select avg(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select avg(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 2.000000000 then
return -1
......@@ -79,7 +83,9 @@ if $data01 != 9.500000000 then
endi
print =============== step6
sql select avg(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select avg(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data01
if $data41 != 4.000000000 then
return -1
......@@ -96,7 +102,9 @@ if $data00 != 9.500000000 then
endi
print =============== step8
sql select avg(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select avg(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 2.000000000 then
return -1
......@@ -108,7 +116,9 @@ if $data00 != 9.500000000 then
return -1
endi
sql select avg(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select avg(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 2.000000000 then
return -1
......@@ -139,7 +149,9 @@ if $rows != $tbNum then
endi
print =============== step11
sql select avg(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select avg(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol
print ===> $data11
if $data11 != 1.000000000 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,9 @@ if $data01 != 0 then
endi
print =============== step3
sql select bottom(tbcol, 1) from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select bottom(tbcol, 1) from $tb where ts > $ms
print ===> $data01
if $data01 != 5 then
return -1
......@@ -76,7 +80,9 @@ if $data11 != 1 then
endi
print =============== step6
sql select bottom(tbcol, 2) as b from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select bottom(tbcol, 2) as b from $tb where ts > $ms
print ===> $data01 $data11
if $data01 != 5 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -65,7 +67,9 @@ if $data00 != $rowNum then
endi
print =============== step3
sql select count(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 5 then
return -1
......@@ -92,7 +96,9 @@ if $data01 != $rowNum then
endi
print =============== step6
sql select count(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data01
if $data01 != 1 then
return -1
......@@ -122,7 +128,9 @@ if $data00 != $totalNum then
endi
print =============== step10
sql select count(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 50 then
return -1
......@@ -134,7 +142,9 @@ if $data00 != 100 then
return -1
endi
sql select count(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 25 then
return -1
......@@ -168,7 +178,9 @@ if $rows != $tbNum then
endi
print =============== step11
sql select count(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol
print ===> $data01
if $data01 != 1 then
return -1
......
......@@ -31,8 +31,9 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,13 +53,17 @@ if $data11 != 1 then
endi
print =============== step3
sql select diff(tbcol) from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select diff(tbcol) from $tb where ts > $ms
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select diff(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select diff(tbcol) from $tb where ts <= $ms
print ===> $data11
if $data11 != 1 then
return -1
......@@ -77,7 +82,9 @@ sql select diff(tbcol) as b from $tb interval(1m) -x step5
step5:
print =============== step6
sql select diff(tbcol) as b from $tb where ts < now + 4m interval(1m) -x step6
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select diff(tbcol) as b from $tb where ts <= $ms interval(1m) -x step6
return -1
step6:
......
......@@ -31,9 +31,11 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
$cc = $x * 60000
$ms = 1601481600000 + $cc
$tinyint = $x / 128
sql insert into $tb values (now + $ms , $x , $x , $x , $x , $tinyint , $x , $x , $x , $x )
sql insert into $tb values ($ms , $x , $x , $x , $x , $tinyint , $x , $x , $x , $x )
$x = $x + 1
endw
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,9 @@ if $data00 != 0 then
endi
print =============== step3
sql select first(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select first(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 0 then
return -1
......@@ -79,7 +83,9 @@ if $data01 != 0 then
endi
print =============== step6
sql select first(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select first(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data01
if $data41 != 4 then
return -1
......@@ -96,7 +102,9 @@ if $data00 != 0 then
endi
print =============== step8
sql select first(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select first(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 0 then
return -1
......@@ -108,7 +116,9 @@ if $data00 != 0 then
return -1
endi
sql select first(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select first(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 0 then
return -1
......@@ -140,7 +150,9 @@ if $rows != $tbNum then
endi
print =============== step11
sql select first(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select first(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -56,7 +58,9 @@ if $data05 != 1 then
endi
print =============== step3
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m)
print ===> $rows
if $rows > 10 then
return -1
......@@ -72,7 +76,13 @@ if $data05 != 1 then
endi
print =============== step4
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now-1m interval(1m)
$cc = 40 * 60000
$ms = 1601481600000 + $cc
$cc = 1 * 60000
$ms2 = 1601481600000 - $cc
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m)
print ===> $rows
if $rows < 18 then
return -1
......@@ -88,7 +98,13 @@ if $data05 != 1 then
endi
print =============== step5
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now+1m interval(1m) fill(value,0)
$cc = 40 * 60000
$ms = 1601481600000 + $cc
$cc = 1 * 60000
$ms2 = 1601481600000 - $cc
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
print ===> $rows
if $rows < 30 then
return -1
......@@ -120,7 +136,9 @@ if $data11 < 5 then
endi
print =============== step7
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m)
print ===> $rows
if $rows < 3 then
return -1
......@@ -136,7 +154,13 @@ if $data11 < 5 then
endi
print =============== step8
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now-1m interval(1m)
$cc = 40 * 60000
$ms1 = 1601481600000 + $cc
$cc = 1 * 60000
$ms2 = 1601481600000 - $cc
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m)
print ===> $rows
if $rows < 18 then
return -1
......@@ -152,7 +176,13 @@ if $data11 < 5 then
endi
print =============== step9
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now+1m interval(1m) fill(value, 0)
$cc = 40 * 60000
$ms1 = 1601481600000 + $cc
$cc = 1 * 60000
$ms2 = 1601481600000 - $cc
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0)
if $rows < 30 then
return -1
endi
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,10 @@ if $data00 != 19 then
endi
print =============== step3
sql select last(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -79,7 +84,10 @@ if $data01 != 19 then
endi
print =============== step6
sql select last(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
......@@ -96,7 +104,10 @@ if $data00 != 19 then
endi
print =============== step8
sql select last(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -108,7 +119,10 @@ if $data00 != 19 then
return -1
endi
sql select last(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -139,7 +153,10 @@ if $rows != $tbNum then
endi
print =============== step11
sql select last(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,9 @@ if $data00 != 19 then
endi
print =============== step3
sql select last_row(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last_row(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -75,7 +79,9 @@ if $data00 != 19 then
endi
print =============== step8
sql select last_row(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last_row(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -87,7 +93,9 @@ if $data00 != 19 then
return -1
endi
sql select last_row(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select last_row(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -108,18 +116,37 @@ endi
print =============== step11
sql insert into $tb values(now + 1h, 10)
sql insert into $tb values(now + 3h, null)
sql insert into $tb values(now + 5h, -1)
sql insert into $tb values(now + 7h, null)
$cc = 1 * 3600000
$ms = 1601481600000 + $cc
sql insert into $tb values( $ms , 10)
$cc = 3 * 3600000
$ms = 1601481600000 + $cc
sql insert into $tb values( $ms , null)
$cc = 5 * 3600000
$ms = 1601481600000 + $cc
sql insert into $tb values( $ms , -1)
$cc = 7 * 3600000
$ms = 1601481600000 + $cc
sql insert into $tb values( $ms , null)
## for super table
sql select last_row(*) from $mt where ts < now + 6h
$cc = 6 * 3600000
$ms = 1601481600000 + $cc
sql select last_row(*) from $mt where ts < $ms
if $data01 != -1 then
return -1
endi
sql select last_row(*) from $mt where ts < now + 8h
$cc = 8 * 3600000
$ms = 1601481600000 + $cc
sql select last_row(*) from $mt where ts < $ms
if $data01 != NULL then
return -1
endi
......@@ -129,23 +156,37 @@ if $data01 != NULL then
return -1
endi
sql select last_row(*) from $mt where ts < now + 4h
$cc = 4 * 3600000
$ms = 1601481600000 + $cc
sql select last_row(*) from $mt where ts < $ms
if $data01 != NULL then
return -1
endi
sql select last_row(*) from $mt where ts > now + 1h and ts < now + 4h
$cc = 1 * 3600000
$ms1 = 1601481600000 + $cc
$cc = 4 * 3600000
$ms2 = 1601481600000 + $cc
sql select last_row(*) from $mt where ts > $ms1 and ts <= $ms2
if $data01 != NULL then
return -1
endi
## for table
sql select last_row(*) from $tb where ts < now + 6h
$cc = 6 * 3600000
$ms = 1601481600000 + $cc
sql select last_row(*) from $tb where ts <= $ms
if $data01 != -1 then
return -1
endi
sql select last_row(*) from $tb where ts < now + 8h
$cc = 8 * 3600000
$ms = 1601481600000 + $cc
sql select last_row(*) from $tb where ts <= $ms
if $data01 != NULL then
return -1
endi
......@@ -155,12 +196,20 @@ if $data01 != NULL then
return -1
endi
sql select last_row(*) from $tb where ts < now + 4h
$cc = 4 * 3600000
$ms = 1601481600000 + $cc
sql select last_row(*) from $tb where ts <= $ms
if $data01 != NULL then
return -1
endi
sql select last_row(*) from $tb where ts > now + 1h and ts < now + 4h
$cc = 1 * 3600000
$ms1 = 1601481600000 + $cc
$cc = 4 * 3600000
$ms2 = 1601481600000 + $cc
sql select last_row(*) from $tb where ts > $ms1 and ts <= $ms2
if $data01 != NULL then
return -1
endi
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,10 @@ if $data00 != 19 then
endi
print =============== step3
sql select max(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select max(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -79,7 +84,10 @@ if $data01 != 19 then
endi
print =============== step6
sql select max(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select max(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
......@@ -96,7 +104,10 @@ if $data00 != 19 then
endi
print =============== step8
sql select max(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select max(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -108,7 +119,10 @@ if $data00 != 19 then
return -1
endi
sql select max(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select max(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 4 then
return -1
......@@ -139,7 +153,10 @@ if $rows != $tbNum then
endi
print =============== step11
sql select max(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select max(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
......
......@@ -32,8 +32,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -53,7 +55,10 @@ if $data00 != 0 then
endi
print =============== step3
sql select min(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select min(tbcol) from $tb where ts < $ms
print ===> $data00
if $data00 != 0 then
return -1
......@@ -80,7 +85,11 @@ if $data01 != 0 then
endi
print =============== step6
sql select min(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select min(tbcol) as b from $tb where ts <= $ms interval(1m)
print select min(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
......@@ -97,7 +106,9 @@ if $data00 != 0 then
endi
print =============== step8
sql select min(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select min(tbcol) as c from $mt where ts < $ms
print ===> $data00
if $data00 != 0 then
return -1
......@@ -109,7 +120,9 @@ if $data00 != 0 then
return -1
endi
sql select min(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select min(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 0 then
return -1
......@@ -140,7 +153,9 @@ if $rows != $tbNum then
endi
print =============== step11
sql select min(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select min(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
......
......@@ -31,14 +31,16 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
$cc = $x * 60000
$ms = 1601481600000 + $cc
$v1 = $x
$v2 = $x
if $x == 0 then
$v1 = NULL
endi
sql insert into $tb values (now + $ms , $v1 , $v2 )
$v1 = $x
$v2 = $x
if $x == 0 then
$v1 = NULL
endi
sql insert into $tb values ($ms , $v1 , $v2 )
$x = $x + 1
endw
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -68,38 +70,56 @@ sql select percentile(tbcol, 110) from $tb -x step2
step2:
print =============== step3
sql select percentile(tbcol, 1) from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select percentile(tbcol, 1) from $tb where ts > $ms
print ===> $data00
if $data00 != 5.140000000 then
return -1
endi
sql select percentile(tbcol, 5) from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select percentile(tbcol, 5) from $tb where ts > $ms
print ===> $data00
if $data00 != 5.700000000 then
return -1
endi
sql select percentile(tbcol, 0) from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select percentile(tbcol, 0) from $tb where ts > $ms
print ===> $data00
if $data00 != 5.000000000 then
return -1
endi
print =============== step4
sql select percentile(tbcol, 1) as c from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select percentile(tbcol, 1) as c from $tb where ts > $ms
print ===> $data00
if $data00 != 5.140000000 then
return -1
endi
sql select percentile(tbcol, 5) as c from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select percentile(tbcol, 5) as c from $tb where ts > $ms
print ===> $data00
if $data00 != 5.700000000 then
return -1
endi
sql select percentile(tbcol, 0) as c from $tb where ts > now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select percentile(tbcol, 0) as c from $tb where ts > $ms
print ===> $data00
if $data00 != 5.000000000 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,10 @@ if $data00 != 5.766281297 then
endi
print =============== step3
sql select stddev(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select stddev(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 1.414213562 then
return -1
......@@ -79,7 +84,10 @@ if $data01 != 5.766281297 then
endi
print =============== step6
sql select stddev(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select stddev(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data01
if $data01 != 0.000000000 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,10 @@ if $data00 != 190 then
endi
print =============== step3
sql select sum(tbcol) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select sum(tbcol) from $tb where ts <= $ms
print ===> $data00
if $data00 != 10 then
return -1
......@@ -79,7 +84,10 @@ if $data01 != 190 then
endi
print =============== step6
sql select sum(tbcol) as b from $tb where ts < now + 4m interval(1m)
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select sum(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
......@@ -96,7 +104,10 @@ if $data00 != 1900 then
endi
print =============== step8
sql select sum(tbcol) as c from $mt where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select sum(tbcol) as c from $mt where ts <= $ms
print ===> $data00
if $data00 != 100 then
return -1
......@@ -108,7 +119,10 @@ if $data00 != 950 then
return -1
endi
sql select sum(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select sum(tbcol) as c from $mt where tgcol < 5 and ts <= $ms
print ===> $data00
if $data00 != 50 then
return -1
......@@ -139,8 +153,11 @@ if $rows != $tbNum then
endi
print =============== step11
sql select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol
print select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select sum(tbcol) as b from $mt where ts <= $ms interval(1d) group by tgcol
print select sum(tbcol) as b from $mt where ts <= $ms interval(1d) group by tgcol
print ===> $data01
if $data01 != 10 then
return -1
......
......@@ -31,8 +31,10 @@ while $i < $tbNum
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
......@@ -52,7 +54,10 @@ if $data01 != 19 then
endi
print =============== step3
sql select top(tbcol, 1) from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select top(tbcol, 1) from $tb where ts <= $ms
print ===> $data01
if $data01 != 4 then
return -1
......@@ -76,7 +81,10 @@ if $data11 != 19 then
endi
print =============== step6
sql select top(tbcol, 2) as b from $tb where ts < now + 4m
$cc = 4 * 60000
$ms = 1601481600000 + $cc
sql select top(tbcol, 2) as b from $tb where ts <= $ms
print ===> $data01 $data11
if $data01 != 3 then
return -1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册