diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index a603bffba5f37b79ee9f4a42546b8bbb3a0c32ea..d8efcf50cac24dca0b444f2e54bf886453e1bb96 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn pBuf->useSize = sizeof(SDataCacheEntry); pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols); -// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); -// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + // ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + // ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); pBuf->useSize += pEntry->dataLen; @@ -135,7 +135,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, taosFreeQitem(pBuf); return TSDB_CODE_OUT_OF_MEMORY; } - + toDataCacheEntry(pDispatcher, pInput, pBuf); taosWriteQitem(pDispatcher->pDataBlocks, pBuf); @@ -162,14 +162,16 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDispatchBuf* pBuf = NULL; taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf); - memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf)); - taosFreeQitem(pBuf); + if (pBuf != NULL) { + memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf)); + taosFreeQitem(pBuf); + } SDataCacheEntry* pEntry = (SDataCacheEntry*)pDispatcher->nextOutput.pData; *pLen = pEntry->dataLen; -// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); -// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + // ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + // ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); *pQueryEnd = pDispatcher->queryEnd; qDebug("got data len %" PRId64 ", row num %d in sink", *pLen, @@ -192,8 +194,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) { pOutput->numOfCols = pEntry->numOfCols; pOutput->compressed = pEntry->compressed; -// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); -// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + // ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + // ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); atomic_sub_fetch_64(&pDispatcher->cachedSize, pEntry->dataLen); atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pEntry->dataLen); diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 7cc93b448fec577d7449b9d71e481b56080090d9..5791a634df4996a3c0489630e703a8c040e3a955 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -290,7 +290,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta* } int32_t code = createTableDataCxt(pTableMeta, pCreateTbReq, pTableCxt, colMode); if (TSDB_CODE_SUCCESS == code) { - code = taosHashPut(pHash, id, idLen, pTableCxt, POINTER_BYTES); + void* pData = *pTableCxt; // deal scan coverity + code = taosHashPut(pHash, id, idLen, &pData, POINTER_BYTES); } return code; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6e94883849c13fb719654df477ab550aee716ef1..9c91ce168845e8060383bff376814b71270d09c8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3517,7 +3517,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS if (comp > 0) { SNode* pRightFunc = NULL; int32_t code = createCastFunc(pCxt, pRight, pLeftExpr->resType, &pRightFunc); - if (TSDB_CODE_SUCCESS != code) { + if (TSDB_CODE_SUCCESS != code || NULL == pRightFunc) { // deal scan coverity return code; } REPLACE_LIST2_NODE(pRightFunc); @@ -3525,7 +3525,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS } else if (comp < 0) { SNode* pLeftFunc = NULL; int32_t code = createCastFunc(pCxt, pLeft, pRightExpr->resType, &pLeftFunc); - if (TSDB_CODE_SUCCESS != code) { + if (TSDB_CODE_SUCCESS != code || NULL == pLeftFunc) { // deal scan coverity return code; } REPLACE_LIST1_NODE(pLeftFunc);