enh:modify error code passing

This commit is contained in:
lyh250-666 2024-10-09 15:37:00 +08:00
parent 388148d2e0
commit 676f8759e2
19 changed files with 46 additions and 46 deletions

View File

@ -55,7 +55,7 @@ static int32_t hbProcessUserAuthInfoRsp(void *value, int32_t valueLen, struct SC
for (int32_t i = 0; i < numOfBatchs; ++i) { for (int32_t i = 0; i < numOfBatchs; ++i) {
SGetUserAuthRsp *rsp = taosArrayGet(batchRsp.pArray, i); SGetUserAuthRsp *rsp = taosArrayGet(batchRsp.pArray, i);
if (NULL == rsp) { if (NULL == rsp) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _return; goto _return;
} }
tscDebug("hb to update user auth, user:%s, version:%d", rsp->user, rsp->version); tscDebug("hb to update user auth, user:%s, version:%d", rsp->user, rsp->version);
@ -217,7 +217,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
for (int32_t i = 0; i < numOfBatchs; ++i) { for (int32_t i = 0; i < numOfBatchs; ++i) {
SDbHbRsp *rsp = taosArrayGet(batchRsp.pArray, i); SDbHbRsp *rsp = taosArrayGet(batchRsp.pArray, i);
if (NULL == rsp) { if (NULL == rsp) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _return; goto _return;
} }
if (rsp->useDbRsp) { if (rsp->useDbRsp) {
@ -291,7 +291,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
for (int32_t i = 0; i < numOfMeta; ++i) { for (int32_t i = 0; i < numOfMeta; ++i) {
STableMetaRsp *rsp = taosArrayGet(hbRsp.pMetaRsp, i); STableMetaRsp *rsp = taosArrayGet(hbRsp.pMetaRsp, i);
if (NULL == rsp) { if (NULL == rsp) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _return; goto _return;
} }
if (rsp->numOfColumns < 0) { if (rsp->numOfColumns < 0) {
@ -313,7 +313,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
for (int32_t i = 0; i < numOfIndex; ++i) { for (int32_t i = 0; i < numOfIndex; ++i) {
STableIndexRsp *rsp = taosArrayGet(hbRsp.pIndexRsp, i); STableIndexRsp *rsp = taosArrayGet(hbRsp.pIndexRsp, i);
if (NULL == rsp) { if (NULL == rsp) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _return; goto _return;
} }
TSC_ERR_JRET(catalogUpdateTableIndex(pCatalog, rsp)); TSC_ERR_JRET(catalogUpdateTableIndex(pCatalog, rsp));
@ -354,7 +354,7 @@ static int32_t hbProcessViewInfoRsp(void *value, int32_t valueLen, struct SCatal
for (int32_t i = 0; i < numOfMeta; ++i) { for (int32_t i = 0; i < numOfMeta; ++i) {
SViewMetaRsp *rsp = taosArrayGetP(hbRsp.pViewRsp, i); SViewMetaRsp *rsp = taosArrayGetP(hbRsp.pViewRsp, i);
if (NULL == rsp) { if (NULL == rsp) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _return; goto _return;
} }
if (rsp->numOfCols < 0) { if (rsp->numOfCols < 0) {

View File

@ -949,7 +949,7 @@ int32_t handleQueryExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog,
for (int32_t i = 0; i < tbNum; ++i) { for (int32_t i = 0; i < tbNum; ++i) {
STbVerInfo* tbInfo = taosArrayGet(pTbArray, i); STbVerInfo* tbInfo = taosArrayGet(pTbArray, i);
if (NULL == tbInfo) { if (NULL == tbInfo) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _return; goto _return;
} }
STbSVersion tbSver = {.tbFName = tbInfo->tbFName, .sver = tbInfo->sversion, .tver = tbInfo->tversion}; STbSVersion tbSver = {.tbFName = tbInfo->tbFName, .sver = tbInfo->sversion, .tver = tbInfo->tversion};

View File

@ -1918,7 +1918,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter);
if (!tbName) { if (!tbName) {
SET_ERROR_MSG("block tbname is null"); SET_ERROR_MSG("block tbname is null");
code = TSDB_CODE_TMQ_INVALID_MSG; code = terrno;
goto end; goto end;
} }

View File

@ -393,7 +393,7 @@ int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements) {
tinfo->tags = taosArrayDup(info->preLineTagKV, NULL); tinfo->tags = taosArrayDup(info->preLineTagKV, NULL);
if (tinfo->tags == NULL) { if (tinfo->tags == NULL) {
smlDestroyTableInfo(&tinfo); smlDestroyTableInfo(&tinfo);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
for (size_t i = 0; i < taosArrayGetSize(info->preLineTagKV); i++) { for (size_t i = 0; i < taosArrayGetSize(info->preLineTagKV); i++) {
SSmlKv *kv = (SSmlKv *)taosArrayGet(info->preLineTagKV, i); SSmlKv *kv = (SSmlKv *)taosArrayGet(info->preLineTagKV, i);
@ -561,7 +561,7 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) {
if (strlen(oneTable->childTableName) == 0) { if (strlen(oneTable->childTableName) == 0) {
SArray *dst = taosArrayDup(oneTable->tags, NULL); SArray *dst = taosArrayDup(oneTable->tags, NULL);
if (dst == NULL) { if (dst == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if (oneTable->sTableNameLen >= TSDB_TABLE_NAME_LEN) { if (oneTable->sTableNameLen >= TSDB_TABLE_NAME_LEN) {
uError("SML:smlSetCTableName super table name is too long"); uError("SML:smlSetCTableName super table name is too long");
@ -957,7 +957,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool
for (; i < taosArrayGetSize(cols); i++) { for (; i < taosArrayGetSize(cols); i++) {
SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i);
if (kv == NULL) { if (kv == NULL) {
code = TSDB_CODE_SML_INVALID_DATA; code = terrno;
goto END; goto END;
} }
if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) { if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) {
@ -1053,7 +1053,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
for (int32_t i = 0; i < pReq.numOfColumns; ++i) { for (int32_t i = 0; i < pReq.numOfColumns; ++i) {
SField *pField = taosArrayGet(pColumns, i); SField *pField = taosArrayGet(pColumns, i);
if (pField == NULL) { if (pField == NULL) {
code = TSDB_CODE_SML_INVALID_DATA; code = terrno;
goto end; goto end;
} }
SFieldWithOptions fieldWithOption = {0}; SFieldWithOptions fieldWithOption = {0};

View File

@ -983,7 +983,7 @@ int stmtSetDbName(TAOS_STMT* stmt, const char* dbName) {
taosMemoryFreeClear(pStmt->exec.pRequest->pDb); taosMemoryFreeClear(pStmt->exec.pRequest->pDb);
pStmt->exec.pRequest->pDb = taosStrdup(dbName); pStmt->exec.pRequest->pDb = taosStrdup(dbName);
if (pStmt->exec.pRequest->pDb == NULL) { if (pStmt->exec.pRequest->pDb == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -850,7 +850,7 @@ static int stmtSetDbName2(TAOS_STMT2* stmt, const char* dbName) {
taosMemoryFreeClear(pStmt->exec.pRequest->pDb); taosMemoryFreeClear(pStmt->exec.pRequest->pDb);
pStmt->exec.pRequest->pDb = taosStrdup(dbName); pStmt->exec.pRequest->pDb = taosStrdup(dbName);
if (pStmt->exec.pRequest->pDb == NULL) { if (pStmt->exec.pRequest->pDb == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -826,7 +826,7 @@ static int32_t innerCommitAll(tmq_t* tmq, SMqCommitCbParamSet* pParamSet){
for (int32_t j = 0; j < numOfVgroups; j++) { for (int32_t j = 0; j < numOfVgroups; j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
if (pVg == NULL) { if (pVg == NULL) {
code = TSDB_CODE_INVALID_PARA; code = terrno;
goto END; goto END;
} }

View File

@ -362,7 +362,7 @@ static int32_t taosSplitS3Cfg(SConfig *pCfg, const char *name, char gVarible[TSD
char *strDup = NULL; char *strDup = NULL;
if ((strDup = taosStrdup(pItem->str))== NULL){ if ((strDup = taosStrdup(pItem->str))== NULL){
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }

View File

@ -284,7 +284,7 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, col++); SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
if (pColInfo == NULL) { if (pColInfo == NULL) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
TAOS_CHECK_GOTO(code, NULL, _exit); TAOS_CHECK_GOTO(code, NULL, _exit);
} }
@ -297,7 +297,7 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
pColInfo = taosArrayGet(pBlock->pDataBlock, col++); pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
if (pColInfo == NULL) { if (pColInfo == NULL) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
TAOS_CHECK_GOTO(code, NULL, _exit); TAOS_CHECK_GOTO(code, NULL, _exit);
} }
@ -309,7 +309,7 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
pColInfo = taosArrayGet(pBlock->pDataBlock, col++); pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
if (pColInfo == NULL) { if (pColInfo == NULL) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
TAOS_CHECK_GOTO(code, NULL, _exit); TAOS_CHECK_GOTO(code, NULL, _exit);
} }
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit);

View File

@ -65,7 +65,7 @@ int32_t dmInitDnode(SDnode *pDnode) {
snprintf(path, sizeof(path), "%s%s%s", tsDataDir, TD_DIRSEP, pWrapper->name); snprintf(path, sizeof(path), "%s%s%s", tsDataDir, TD_DIRSEP, pWrapper->name);
pWrapper->path = taosStrdup(path); pWrapper->path = taosStrdup(path);
if (pWrapper->path == NULL) { if (pWrapper->path == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }

View File

@ -495,7 +495,7 @@ static int32_t mndCreateDir(SMnode *pMnode, const char *path) {
int32_t code = 0; int32_t code = 0;
pMnode->path = taosStrdup(path); pMnode->path = taosStrdup(path);
if (pMnode->path == NULL) { if (pMnode->path == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TAOS_RETURN(code); TAOS_RETURN(code);
} }

View File

@ -2350,7 +2350,7 @@ int32_t dumpTSMAInfoFromSmaObj(const SSmaObj* pSma, const SStbObj* pDestStb, STa
nodesDestroyNode(pNode); nodesDestroyNode(pNode);
} }
pInfo->ast = taosStrdup(pSma->ast); pInfo->ast = taosStrdup(pSma->ast);
if (!pInfo->ast) code = TSDB_CODE_OUT_OF_MEMORY; if (!pInfo->ast) code = terrno;
if (code == TSDB_CODE_SUCCESS && pDestStb->numOfTags > 0) { if (code == TSDB_CODE_SUCCESS && pDestStb->numOfTags > 0) {
pInfo->pTags = taosArrayInit(pDestStb->numOfTags, sizeof(SSchema)); pInfo->pTags = taosArrayInit(pDestStb->numOfTags, sizeof(SSchema));

View File

@ -594,7 +594,7 @@ int32_t mndFetchAllIpWhite(SMnode *pMnode, SHashObj **ppIpWhiteTab) {
if (name == NULL) { if (name == NULL) {
sdbRelease(pSdb, pUser); sdbRelease(pSdb, pUser);
sdbCancelFetch(pSdb, pIter); sdbCancelFetch(pSdb, pIter);
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); TAOS_CHECK_GOTO(terrno, &lino, _OVER);
} }
if (taosArrayPush(pUserNames, &name) == NULL) { if (taosArrayPush(pUserNames, &name) == NULL) {
taosMemoryFree(name); taosMemoryFree(name);
@ -617,7 +617,7 @@ int32_t mndFetchAllIpWhite(SMnode *pMnode, SHashObj **ppIpWhiteTab) {
if (found == false) { if (found == false) {
char *name = taosStrdup(TSDB_DEFAULT_USER); char *name = taosStrdup(TSDB_DEFAULT_USER);
if (name == NULL) { if (name == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); TAOS_CHECK_GOTO(terrno, &lino, _OVER);
} }
if (taosArrayPush(pUserNames, &name) == NULL) { if (taosArrayPush(pUserNames, &name) == NULL) {
taosMemoryFree(name); taosMemoryFree(name);

View File

@ -596,7 +596,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void
pReader->status.pPrimaryTsCol = taosArrayGet(pReader->resBlockInfo.pResBlock->pDataBlock, pSup->slotId[0]); pReader->status.pPrimaryTsCol = taosArrayGet(pReader->resBlockInfo.pResBlock->pDataBlock, pSup->slotId[0]);
if (pReader->status.pPrimaryTsCol == NULL) { if (pReader->status.pPrimaryTsCol == NULL) {
code = TSDB_CODE_INVALID_PARA; code = terrno;
goto _end; goto _end;
} }

View File

@ -254,7 +254,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
if (mer1.me.ctbEntry.commentLen > 0) { if (mer1.me.ctbEntry.commentLen > 0) {
cfgRsp.pComment = taosStrdup(mer1.me.ctbEntry.comment); cfgRsp.pComment = taosStrdup(mer1.me.ctbEntry.comment);
if (NULL == cfgRsp.pComment) { if (NULL == cfgRsp.pComment) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -273,7 +273,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
if (mer1.me.ntbEntry.commentLen > 0) { if (mer1.me.ntbEntry.commentLen > 0) {
cfgRsp.pComment = taosStrdup(mer1.me.ntbEntry.comment); cfgRsp.pComment = taosStrdup(mer1.me.ntbEntry.comment);
if (NULL == cfgRsp.pComment) { if (NULL == cfgRsp.pComment) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -399,7 +399,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
for (int32_t i = 0; i < msgNum; ++i) { for (int32_t i = 0; i < msgNum; ++i) {
req = taosArrayGet(batchReq.pMsgs, i); req = taosArrayGet(batchReq.pMsgs, i);
if (req == NULL) { if (req == NULL) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }

View File

@ -1108,7 +1108,7 @@ int32_t ctgUpdateMsgCtx(SCtgMsgCtx* pCtx, int32_t reqType, void* out, char* targ
if (target) { if (target) {
pCtx->target = taosStrdup(target); pCtx->target = taosStrdup(target);
if (NULL == pCtx->target) { if (NULL == pCtx->target) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} else { } else {
pCtx->target = NULL; pCtx->target = NULL;
@ -1125,7 +1125,7 @@ int32_t ctgAddMsgCtx(SArray* pCtxs, int32_t reqType, void* out, char* target) {
if (target) { if (target) {
ctx.target = taosStrdup(target); ctx.target = taosStrdup(target);
if (NULL == ctx.target) { if (NULL == ctx.target) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1631,7 +1631,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) {
if (NULL == (*dst)->vgArray) { if (NULL == (*dst)->vgArray) {
taosHashCleanup((*dst)->vgHash); taosHashCleanup((*dst)->vgHash);
taosMemoryFreeClear(*dst); taosMemoryFreeClear(*dst);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1698,7 +1698,7 @@ int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes) {
} }
pInfo->expr = taosStrdup(pInfo->expr); pInfo->expr = taosStrdup(pInfo->expr);
if (NULL == pInfo->expr) { if (NULL == pInfo->expr) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1712,7 +1712,7 @@ int32_t ctgUpdateSendTargetInfo(SMsgSendInfo* pMsgSendInfo, int32_t msgType, cha
pMsgSendInfo->target.vgId = vgId; pMsgSendInfo->target.vgId = vgId;
pMsgSendInfo->target.dbFName = taosStrdup(dbFName); pMsgSendInfo->target.dbFName = taosStrdup(dbFName);
if (NULL == pMsgSendInfo->target.dbFName) { if (NULL == pMsgSendInfo->target.dbFName) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} else { } else {
pMsgSendInfo->target.type = TARGET_TYPE_MNODE; pMsgSendInfo->target.type = TARGET_TYPE_MNODE;

View File

@ -522,7 +522,7 @@ static int32_t buildGroupCacheBaseBlock(SSDataBlock** ppDst, SSDataBlock* pSrc)
(*ppDst)->pDataBlock = taosArrayDup(pSrc->pDataBlock, NULL); (*ppDst)->pDataBlock = taosArrayDup(pSrc->pDataBlock, NULL);
if (NULL == (*ppDst)->pDataBlock) { if (NULL == (*ppDst)->pDataBlock) {
taosMemoryFree(*ppDst); taosMemoryFree(*ppDst);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
TAOS_MEMCPY(&(*ppDst)->info, &pSrc->info, sizeof(pSrc->info)); TAOS_MEMCPY(&(*ppDst)->info, &pSrc->info, sizeof(pSrc->info));
blockDataDeepClear(*ppDst); blockDataDeepClear(*ppDst);

View File

@ -2153,7 +2153,7 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t slotId = pCtx->pExpr->base.resSchema.slotId; int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
if (NULL == pCol) { if (NULL == pCol) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _fin_error; goto _fin_error;
} }
@ -3676,7 +3676,7 @@ int32_t diffFunctionByRow(SArray* pCtxArray) {
for (int i = 0; i < diffColNum; ++i) { for (int i = 0; i < diffColNum; ++i) {
SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i); SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i);
if (NULL == pCtx) { if (NULL == pCtx) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
funcInputUpdate(pCtx); funcInputUpdate(pCtx);
@ -3690,7 +3690,7 @@ int32_t diffFunctionByRow(SArray* pCtxArray) {
SqlFunctionCtx* pCtx0 = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, 0); SqlFunctionCtx* pCtx0 = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, 0);
SFuncInputRow* pRow0 = (SFuncInputRow*)taosArrayGet(pRows, 0); SFuncInputRow* pRow0 = (SFuncInputRow*)taosArrayGet(pRows, 0);
if (NULL == pCtx0 || NULL == pRow0) { if (NULL == pCtx0 || NULL == pRow0) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
int32_t startOffset = pCtx0->offset; int32_t startOffset = pCtx0->offset;
@ -3708,7 +3708,7 @@ int32_t diffFunctionByRow(SArray* pCtxArray) {
SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i); SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i);
SFuncInputRow* pRow = (SFuncInputRow*)taosArrayGet(pRows, i); SFuncInputRow* pRow = (SFuncInputRow*)taosArrayGet(pRows, i);
if (NULL == pCtx || NULL == pRow) { if (NULL == pCtx || NULL == pRow) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
code = funcInputGetNextRow(pCtx, pRow, &result); code = funcInputGetNextRow(pCtx, pRow, &result);
@ -3731,7 +3731,7 @@ int32_t diffFunctionByRow(SArray* pCtxArray) {
SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i); SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i);
SFuncInputRow* pRow = (SFuncInputRow*)taosArrayGet(pRows, i); SFuncInputRow* pRow = (SFuncInputRow*)taosArrayGet(pRows, i);
if (NULL == pCtx || NULL == pRow) { if (NULL == pCtx || NULL == pRow) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
if ((keepNull || hasNotNullValue) && !isFirstRow(pCtx, pRow)){ if ((keepNull || hasNotNullValue) && !isFirstRow(pCtx, pRow)){
@ -3753,7 +3753,7 @@ int32_t diffFunctionByRow(SArray* pCtxArray) {
for (int i = 0; i < diffColNum; ++i) { for (int i = 0; i < diffColNum; ++i) {
SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i); SqlFunctionCtx* pCtx = *(SqlFunctionCtx**)taosArrayGet(pCtxArray, i);
if (NULL == pCtx) { if (NULL == pCtx) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
@ -4430,7 +4430,7 @@ int32_t spreadPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
if (NULL == pCol) { if (NULL == pCol) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
@ -4620,7 +4620,7 @@ int32_t elapsedPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
if (NULL == pCol) { if (NULL == pCol) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
@ -5003,7 +5003,7 @@ int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
if (NULL == pCol) { if (NULL == pCol) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }
code = colDataSetVal(pCol, pBlock->info.rows, res, false); code = colDataSetVal(pCol, pBlock->info.rows, res, false);
@ -5236,7 +5236,7 @@ int32_t hllPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
if (NULL == pCol) { if (NULL == pCol) {
code = TSDB_CODE_OUT_OF_RANGE; code = terrno;
goto _exit; goto _exit;
} }

View File

@ -113,7 +113,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
SSchema* pTagSchema = &pSchema[tags->pColIndex[i]]; SSchema* pTagSchema = &pSchema[tags->pColIndex[i]];
SSmlKv* kv = taosArrayGet(cols, i); SSmlKv* kv = taosArrayGet(cols, i);
if (kv == NULL){ if (kv == NULL){
code = TSDB_CODE_SML_INVALID_DATA; code = terrno;
uError("SML smlBuildTagRow error kv is null"); uError("SML smlBuildTagRow error kv is null");
goto end; goto end;
} }
@ -381,7 +381,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
for (int32_t r = 0; r < rowNum; ++r) { for (int32_t r = 0; r < rowNum; ++r) {
void* rowData = taosArrayGetP(cols, r); void* rowData = taosArrayGetP(cols, r);
if (rowData == NULL) { if (rowData == NULL) {
ret = TSDB_CODE_SML_INVALID_DATA; ret = terrno;
goto end; goto end;
} }
// 1. set the parsed value from sql string // 1. set the parsed value from sql string
@ -389,7 +389,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
SSchema* pColSchema = &pSchema[pTableCxt->boundColsInfo.pColIndex[c]]; SSchema* pColSchema = &pSchema[pTableCxt->boundColsInfo.pColIndex[c]];
SColVal* pVal = taosArrayGet(pTableCxt->pValues, pTableCxt->boundColsInfo.pColIndex[c]); SColVal* pVal = taosArrayGet(pTableCxt->pValues, pTableCxt->boundColsInfo.pColIndex[c]);
if (pVal == NULL) { if (pVal == NULL) {
ret = TSDB_CODE_SML_INVALID_DATA; ret = terrno;
goto end; goto end;
} }
void** p = taosHashGet(rowData, pColSchema->name, strlen(pColSchema->name)); void** p = taosHashGet(rowData, pColSchema->name, strlen(pColSchema->name));