[td-4739]<fix>: fix bug in derivative.
This commit is contained in:
parent
3e928774d1
commit
5062604688
|
@ -3477,6 +3477,7 @@ static void tscSubqueryRetrieveCallback(void* param, TAOS_RES* tres, int code) {
|
|||
if (pSql->res.code == TSDB_CODE_SUCCESS) {
|
||||
(*pSql->fp)(pParentSql->param, pParentSql, pParentSql->res.numOfRows);
|
||||
} else {
|
||||
pParentSql->res.code = pSql->res.code;
|
||||
tscAsyncResultOnError(pParentSql);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3613,16 +3613,7 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
|
|||
qError("error input type");
|
||||
}
|
||||
|
||||
// initial value is not set yet, all data block are null
|
||||
if (!pDerivInfo->valueSet || notNullElems <= 0) {
|
||||
/*
|
||||
* 1. current block and blocks before are full of null
|
||||
* 2. current block may be null value
|
||||
*/
|
||||
assert(pCtx->hasNull);
|
||||
} else {
|
||||
GET_RES_INFO(pCtx)->numOfRes += notNullElems;
|
||||
}
|
||||
GET_RES_INFO(pCtx)->numOfRes += notNullElems;
|
||||
}
|
||||
|
||||
#define DIFF_IMPL(ctx, d, type) \
|
||||
|
|
|
@ -1073,6 +1073,12 @@ sql insert into t0 values('2020-1-1 1:3:9', 9);
|
|||
sql insert into t0 values('2020-1-1 1:4:10', 10);
|
||||
|
||||
sql insert into t1 values('2020-1-1 1:1:2', 2);
|
||||
print ===========================>td-4739
|
||||
sql select diff(val) from (select derivative(k, 1s, 0) from t1);
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into t1 values('2020-1-1 1:1:4', 20);
|
||||
sql insert into t1 values('2020-1-1 1:1:6', 200);
|
||||
sql insert into t1 values('2020-1-1 1:1:8', 2000);
|
||||
|
|
Loading…
Reference in New Issue