提交 f021f29f 编写于 作者: H Haojun Liao

fix(query): fix bug in limit/offset.

上级 bd8fa533
...@@ -3199,9 +3199,8 @@ static void doHandleRemainBlockFromNewGroup(SFillOperatorInfo* pInfo, SResultInf ...@@ -3199,9 +3199,8 @@ static void doHandleRemainBlockFromNewGroup(SFillOperatorInfo* pInfo, SResultInf
if (taosFillHasMoreResults(pInfo->pFillInfo)) { if (taosFillHasMoreResults(pInfo->pFillInfo)) {
int32_t numOfResultRows = pResultInfo->capacity - pInfo->pRes->info.rows; int32_t numOfResultRows = pResultInfo->capacity - pInfo->pRes->info.rows;
taosFillResultDataBlock(pInfo->pFillInfo, pInfo->pRes, numOfResultRows); taosFillResultDataBlock(pInfo->pFillInfo, pInfo->pRes, numOfResultRows);
if (pInfo->pRes->info.rows > pResultInfo->threshold) { pInfo->pRes->info.groupId = pInfo->curGroupId;
return; return;
}
} }
// handle the cached new group data block // handle the cached new group data block
...@@ -3220,7 +3219,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { ...@@ -3220,7 +3219,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
blockDataCleanup(pResBlock); blockDataCleanup(pResBlock);
doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, pTaskInfo); doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, pTaskInfo);
if (pResBlock->info.rows > pResultInfo->threshold || pResBlock->info.rows > 0) { if (pResBlock->info.rows > 0) {
pResBlock->info.groupId = pInfo->curGroupId; pResBlock->info.groupId = pInfo->curGroupId;
return pResBlock; return pResBlock;
} }
......
...@@ -279,7 +279,9 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { ...@@ -279,7 +279,9 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
// do apply filter // do apply filter
doFilter(pProjectInfo->pFilterNode, pFinalRes, NULL); doFilter(pProjectInfo->pFilterNode, pFinalRes, NULL);
if (pFinalRes->info.rows > 0 || pRes->info.rows == 0) {
// when apply the limit/offset for each group, pRes->info.rows may be 0, due to limit constraint.
if (pFinalRes->info.rows > 0 || (pOperator->status == OP_EXEC_DONE)) {
break; break;
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册