提交 2a45714d 编写于 作者: wmmhello's avatar wmmhello

[TD-6046]<fix> fix ts derivative error

上级 dff67958
......@@ -5590,6 +5590,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
pRes->info.rows = getNumOfResult(pRuntimeEnv, pInfo->pCtx, pOperator->numOfOutput);
if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) {
copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput);
clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput);
return pRes;
}
......@@ -5615,8 +5616,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
if (*newgroup) {
if (pRes->info.rows > 0) {
pProjectInfo->existDataBlock = pBlock;
clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput);
return pInfo->pRes;
break;
} else { // init output buffer for a new group data
for (int32_t j = 0; j < pOperator->numOfOutput; ++j) {
aAggs[pInfo->pCtx[j].functionId].xFinalize(&pInfo->pCtx[j]);
......@@ -5645,9 +5645,8 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
if (pRes->info.rows >= 1000/*pRuntimeEnv->resultInfo.threshold*/) {
break;
}
copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput);
}
copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput);
clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput);
return (pInfo->pRes->info.rows > 0)? pInfo->pRes:NULL;
}
......
......@@ -54,6 +54,19 @@ class TDTestCase:
tdSql.query("select derivative(col, 10s, 0) from stb group by tbname")
tdSql.checkRows(10)
tdSql.query("select ts,derivative(col, 10s, 1),ts from stb group by tbname")
tdSql.checkRows(4)
tdSql.checkData(0, 0, self.ts + 10000)
tdSql.checkData(0, 1, self.ts + 10000)
tdSql.checkData(0, 3, self.ts + 10000)
tdSql.checkData(3, 0, self.ts + 70000)
tdSql.checkData(3, 1, self.ts + 70000)
tdSql.checkData(3, 3, self.ts + 70000)
tdSql.query("select ts from(select ts,derivative(col, 10s, 0) from stb group by tbname")
tdSql.checkData(0, 1, 1)
tdSql.error("select derivative(col, 10s, 0) from tb1 group by tbname")
tdSql.query("select derivative(col, 10s, 1) from tb1")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册