diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c41400f439..c3868ee6d5 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -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; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 85dfa4c866..76d06accf4 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -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) {