未验证 提交 f33c15fb 编写于 作者: G Ganlin Zhao 提交者: GitHub

Merge pull request #15102 from taosdata/fix/TD-17511

fix(query): fix derivative nan value
......@@ -5661,7 +5661,12 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) {
double r = ((v - pDerivInfo->prevValue) * pDerivInfo->tsWindow) / (tsList[i] - pDerivInfo->prevTs);
if (pDerivInfo->ignoreNegative && r < 0) {
} else {
colDataAppend(pOutput, pos, (const char*)&r, false);
if (isinf(r) || isnan(r)) {
colDataAppendNULL(pOutput, pos);
} else {
colDataAppend(pOutput, pos, (const char*)&r, false);
}
if (pTsOutput != NULL) {
colDataAppendInt64(pTsOutput, pos, &tsList[i]);
}
......@@ -5688,7 +5693,12 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) {
double r = ((pDerivInfo->prevValue - v) * pDerivInfo->tsWindow) / (pDerivInfo->prevTs - tsList[i]);
if (pDerivInfo->ignoreNegative && r < 0) {
} else {
colDataAppend(pOutput, pos, (const char*)&r, false);
if (isinf(r) || isnan(r)) {
colDataAppendNULL(pOutput, pos);
} else {
colDataAppend(pOutput, pos, (const char*)&r, false);
}
if (pTsOutput != NULL) {
colDataAppendInt64(pTsOutput, pos, &pDerivInfo->prevTs);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册