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