fix(query): return object instead of free it when error happens.

This commit is contained in:
Haojun Liao 2022-04-27 18:12:26 +08:00
parent 7c6bc10760
commit 1c08688da2
2 changed files with 4 additions and 4 deletions

View File

@ -365,9 +365,8 @@ SRequestObj* launchQuery(STscObj* pTscObj, const char* sql, int sqlLen) {
code = parseSql(pRequest, false, &pQuery, NULL);
if (code != TSDB_CODE_SUCCESS) {
destroyRequest(pRequest);
terrno = code;
return NULL;
pRequest->code = code;
return pRequest;
}
return launchQueryImpl(pRequest, pQuery, code, false);
@ -418,7 +417,7 @@ SRequestObj* execQuery(STscObj* pTscObj, const char* sql, int sqlLen) {
while (retryNum++ < REQUEST_MAX_TRY_TIMES) {
pRequest = launchQuery(pTscObj, sql, sqlLen);
if (TSDB_CODE_SUCCESS == pRequest->code || !NEED_CLIENT_HANDLE_ERROR(pRequest->code)) {
if (pRequest == NULL || TSDB_CODE_SUCCESS == pRequest->code || !NEED_CLIENT_HANDLE_ERROR(pRequest->code)) {
break;
}

View File

@ -4997,6 +4997,7 @@ static int32_t handleLimitOffset(SOperatorInfo* pOperator, SSDataBlock* pBlock)
// check for the limitation in each group
if (pProjectInfo->limit.limit > 0 && pProjectInfo->curOutput + pRes->info.rows >= pProjectInfo->limit.limit) {
pRes->info.rows = (int32_t)(pProjectInfo->limit.limit - pProjectInfo->curOutput);
return PROJECT_RETRIEVE_DONE;
}
if (pRes->info.rows >= pOperator->resultInfo.threshold) {