未验证 提交 bf3d97fa 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #7621 from taosdata/hotfix/TD-6384

[td-6384]fix irate wrong value issue
......@@ -4032,11 +4032,23 @@ static void irate_function(SQLFunctionCtx *pCtx) {
double v = 0;
GET_TYPED_DATA(v, double, pCtx->inputType, pData);
if ((INT64_MIN == pRateInfo->lastKey) || primaryKey[i] > pRateInfo->lastKey) {
if (INT64_MIN == pRateInfo->lastKey) {
pRateInfo->lastValue = v;
pRateInfo->lastKey = primaryKey[i];
continue;
}
if (primaryKey[i] > pRateInfo->lastKey) {
if ((INT64_MIN == pRateInfo->firstKey) || pRateInfo->lastKey > pRateInfo->firstKey) {
pRateInfo->firstValue = pRateInfo->lastValue;
pRateInfo->firstKey = pRateInfo->lastKey;
}
pRateInfo->lastValue = v;
pRateInfo->lastKey = primaryKey[i];
continue;
}
if ((INT64_MIN == pRateInfo->firstKey) || primaryKey[i] > pRateInfo->firstKey) {
pRateInfo->firstValue = v;
......
......@@ -941,6 +941,17 @@ if $data32 != 0.000144445 then
return -1
endi
sql insert into t1 values('2015-09-18 00:30:00', 3.0);
sql select irate(k) from t1
if $rows != 1 then
return -1
endi
if $data00 != 0.000000354 then
return -1
endi
print ===========================> derivative
sql drop table t1
sql drop table tx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册