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

This commit is contained in:
Haojun Liao 2022-07-26 19:07:43 +08:00
parent bd8fa53371
commit f021f29f02
2 changed files with 6 additions and 5 deletions

View File

@ -3199,9 +3199,8 @@ static void doHandleRemainBlockFromNewGroup(SFillOperatorInfo* pInfo, SResultInf
if (taosFillHasMoreResults(pInfo->pFillInfo)) {
int32_t numOfResultRows = pResultInfo->capacity - pInfo->pRes->info.rows;
taosFillResultDataBlock(pInfo->pFillInfo, pInfo->pRes, numOfResultRows);
if (pInfo->pRes->info.rows > pResultInfo->threshold) {
return;
}
pInfo->pRes->info.groupId = pInfo->curGroupId;
return;
}
// handle the cached new group data block
@ -3220,7 +3219,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
blockDataCleanup(pResBlock);
doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, pTaskInfo);
if (pResBlock->info.rows > pResultInfo->threshold || pResBlock->info.rows > 0) {
if (pResBlock->info.rows > 0) {
pResBlock->info.groupId = pInfo->curGroupId;
return pResBlock;
}

View File

@ -279,7 +279,9 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
// do apply filter
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;
}
} else {