提交 de6f6a1e 编写于 作者: G Ganlin Zhao

fix(query): eliminate csum/mavg result nan/inf in case of overflow

TD-16053
上级 8035d02d
......@@ -3530,8 +3530,13 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) {
double v;
GET_TYPED_DATA(v, double, type, data);
pSumRes->dsum += v;
//check for overflow
if (isinf(pSumRes->dsum) || isnan(pSumRes->dsum)) {
colDataAppendNULL(pOutput, pos);
} else {
colDataAppend(pOutput, pos, (char *)&pSumRes->dsum, false);
}
}
//TODO: remove this after pTsOutput is handled
if (pTsOutput != NULL) {
......@@ -3604,7 +3609,12 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) {
pInfo->points[pInfo->pos] = v;
double result = pInfo->sum / pInfo->numOfPoints;
//check for overflow
if (isinf(result) || isnan(result)) {
colDataAppendNULL(pOutput, pos);
} else {
colDataAppend(pOutput, pos, (char *)&result, false);
}
//TODO: remove this after pTsOutput is handled
if (pTsOutput != NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册