[TD-2538]<fix>: crash when sql has limit & offset

This commit is contained in:
Bomin Zhang 2020-12-23 08:15:22 +00:00
parent a84e2aa410
commit 566680c78e
1 changed files with 7 additions and 0 deletions

View File

@ -911,6 +911,13 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer,
}
}
if (pRes->numOfRowsGroup >= pQueryInfo->limit.limit && pQueryInfo->limit.limit > 0) {
pRes->numOfRows = 0;
pBeforeFillData->num = 0;
pLocalReducer->discard = true;
return;
}
pRes->numOfRowsGroup += pRes->numOfRows;
// impose the limitation of output rows on the final result