diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 57362499a4fcaaa1500b199de8f63c07a03af898..7f8e9066af2ea05dd2cc50d8a9e156a5b44cb6cc 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1866,6 +1866,7 @@ int tscProcessRetrieveGlobalMergeRsp(SSqlObj *pSql) { bool convertJson = true; if (pQueryInfo->isStddev == true) convertJson = false; convertQueryResult(pRes, pQueryInfo, pSql->self, true, convertJson); + pRes->code = pQueryInfo->pQInfo->code; code = pRes->code; if (pRes->code == TSDB_CODE_SUCCESS) { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 941a0e5710c263da31cbeabe096b62ad6a1877ea..7e19dc9eac74228c7551a2ac70a0a2f2badb3db1 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -3594,7 +3594,7 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf for(int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) { SColumnInfoData *pColInfo = taosArrayGet(pDataBlock->pDataBlock, i); - char* p = realloc(pColInfo->pData, newSize * pColInfo->info.bytes); + char* p = realloc(pColInfo->pData, ((size_t)newSize) * pColInfo->info.bytes); if (p != NULL) { pColInfo->pData = p; @@ -3602,8 +3602,9 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf pBInfo->pCtx[i].pOutput = pColInfo->pData; (*bufCapacity) = newSize; } else { - size_t allocateSize = newSize * pColInfo->info.bytes; - qError("can not allocate %zu bytes for output", allocateSize); + size_t allocateSize = ((size_t)(newSize)) * pColInfo->info.bytes; + qError("can not allocate %zu bytes for output. Rows: %d, colBytes %d", + allocateSize, newSize, pColInfo->info.bytes); longjmp(runtimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); } } @@ -3612,7 +3613,7 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf for (int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) { SColumnInfoData *pColInfo = taosArrayGet(pDataBlock->pDataBlock, i); - pBInfo->pCtx[i].pOutput = pColInfo->pData + pColInfo->info.bytes * pDataBlock->info.rows; + pBInfo->pCtx[i].pOutput = pColInfo->pData + (size_t)pColInfo->info.bytes * pDataBlock->info.rows; // set the correct pointer after the memory buffer reallocated. int32_t functionId = pBInfo->pCtx[i].functionId;