fix coverity issues
This commit is contained in:
parent
420b59fea5
commit
024422bfd7
|
@ -1533,10 +1533,6 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
|||
if (msg) {
|
||||
int8_t inputType = RSMA_EXEC_MSG_TYPE(msg);
|
||||
if (inputType == STREAM_INPUT__DATA_SUBMIT) {
|
||||
if (nDelete > 0) {
|
||||
resume = 1;
|
||||
break;
|
||||
}
|
||||
_resume_submit:
|
||||
packData.msgLen = RSMA_EXEC_MSG_LEN(msg);
|
||||
packData.ver = RSMA_EXEC_MSG_VER(msg);
|
||||
|
@ -1549,10 +1545,6 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
|||
}
|
||||
++nSubmit;
|
||||
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||
if (nSubmit > 0) {
|
||||
resume = 2;
|
||||
break;
|
||||
}
|
||||
_resume_delete:
|
||||
version = RSMA_EXEC_MSG_VER(msg);
|
||||
if ((terrno = tqExtractDelDataBlock(RSMA_EXEC_MSG_BODY(msg), RSMA_EXEC_MSG_LEN(msg), version,
|
||||
|
@ -1593,10 +1585,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
|||
goto _rtn;
|
||||
}
|
||||
|
||||
if (resume == 1) {
|
||||
resume = 0;
|
||||
goto _resume_submit;
|
||||
} else if (resume == 2) {
|
||||
if (resume == 2) {
|
||||
resume = 0;
|
||||
goto _resume_delete;
|
||||
}
|
||||
|
@ -1735,4 +1724,4 @@ _exit:
|
|||
smaError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,12 +488,12 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
|||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
*pLogicNode = (SLogicNode*)pScan;
|
||||
pScan->paraTablesSort = getParaTablesSortOptHint(pSelect->pHint);
|
||||
pScan->smallDataTsSort = getSmallDataTsSortOptHint(pSelect->pHint);
|
||||
pCxt->hasScan = true;
|
||||
} else {
|
||||
nodesDestroyNode((SNode*)pScan);
|
||||
}
|
||||
pScan->paraTablesSort = getParaTablesSortOptHint(pSelect->pHint);
|
||||
pScan->smallDataTsSort = getSmallDataTsSortOptHint(pSelect->pHint);
|
||||
pCxt->hasScan = true;
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -738,11 +738,13 @@ static int32_t addWinJoinPrimKeyToAggFuncs(SSelectStmt* pSelect, SNodeList** pLi
|
|||
pProbeTable = (SRealTableNode*)pJoinTable->pRight;
|
||||
break;
|
||||
default:
|
||||
if (!*pList) nodesDestroyList(pTargets);
|
||||
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
|
||||
if (NULL == pCol) {
|
||||
if (!*pList) nodesDestroyList(pTargets);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
|
|
@ -1598,10 +1598,6 @@ static int32_t pdcRewriteTypeBasedOnJoinRes(SOptimizeContext* pCxt, SJoinLogicNo
|
|||
tSimpleHashCleanup(pLeftTables);
|
||||
tSimpleHashCleanup(pRightTables);
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
switch (pJoin->joinType) {
|
||||
case JOIN_TYPE_LEFT:
|
||||
if (tableResNonNull[1] && !tableResOp[0]) {
|
||||
|
@ -2156,17 +2152,11 @@ static int32_t sortPriKeyOptHandleLeftRightJoinSort(SJoinLogicNode* pJoin, SSort
|
|||
if (sortByProbe) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
*pNotOptimize = true;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
case JOIN_STYPE_ANTI: {
|
||||
if (sortByProbe) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
*keepSort = false;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
case JOIN_STYPE_ASOF:
|
||||
case JOIN_STYPE_WIN: {
|
||||
|
@ -2176,9 +2166,6 @@ static int32_t sortPriKeyOptHandleLeftRightJoinSort(SJoinLogicNode* pJoin, SSort
|
|||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
*pNotOptimize = true;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
default:
|
||||
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||
|
@ -3279,7 +3266,7 @@ static EDealRes eliminateProjOptRewriteScanTableAlias(SNode* pNode, void* pConte
|
|||
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
|
||||
SColumnNode* pCol = (SColumnNode*)pNode;
|
||||
RewriteTableAliasCxt* pCtx = (RewriteTableAliasCxt*)pContext;
|
||||
strcpy(pCol->tableAlias, pCtx->newTableAlias);
|
||||
strncpy(pCol->tableAlias, pCtx->newTableAlias, TSDB_TABLE_NAME_LEN);
|
||||
}
|
||||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
@ -3288,12 +3275,13 @@ static EDealRes eliminateProjOptRewriteScanTableAlias(SNode* pNode, void* pConte
|
|||
static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan,
|
||||
SProjectLogicNode* pProjectNode) {
|
||||
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0);
|
||||
SNodeList* pNewChildTargets = nodesMakeList();
|
||||
|
||||
if (NULL == pProjectNode->node.pParent) {
|
||||
SNode *pProjection = NULL, *pChildTarget = NULL;
|
||||
bool needOrderMatch = QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pChild) && ((SProjectLogicNode*)pChild)->isSetOpProj;
|
||||
bool orderMatch = true;
|
||||
SNodeList* pNewChildTargets = nodesMakeList();
|
||||
SNode * pProjection = NULL, *pChildTarget = NULL;
|
||||
bool orderMatch = true;
|
||||
bool needOrderMatch =
|
||||
QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pChild) && ((SProjectLogicNode*)pChild)->isSetOpProj;
|
||||
if (needOrderMatch) {
|
||||
// For sql: select ... from (select ... union all select ...);
|
||||
// When eliminating the outer proj (the outer select), we have to make sure that the outer proj projections and
|
||||
|
@ -4264,6 +4252,7 @@ static int32_t splitCacheLastFuncOptCreateAggLogicNode(SAggLogicNode** pNewAgg,
|
|||
nodesDestroyList(pScan->node.pTargets);
|
||||
pScan->node.pTargets = NULL;
|
||||
SNodeListNode* list = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST);
|
||||
if (!list) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
list->pNodeList = pFunc;
|
||||
code = nodesCollectColumnsFromNode((SNode*)list, NULL, COLLECT_COL_TYPE_COL, &pScan->pScanCols);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
|
@ -4674,6 +4663,7 @@ static bool pushDownLimitTo(SLogicNode* pNodeWithLimit, SLogicNode* pNodeLimitPu
|
|||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QUERY_NODE_LOGIC_PLAN_JOIN: {
|
||||
cloneLimit(pNodeWithLimit, pNodeLimitPushTo, CLONE_LIMIT);
|
||||
break;
|
||||
|
@ -5028,7 +5018,7 @@ _return:
|
|||
|
||||
if (!res && DATA_ORDER_LEVEL_NONE == pJoin->node.requireDataOrder) {
|
||||
pJoin->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL;
|
||||
adjustLogicNodeDataRequirement(pNode, pJoin->node.requireDataOrder);
|
||||
(void)adjustLogicNodeDataRequirement(pNode, pJoin->node.requireDataOrder);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
@ -695,7 +695,7 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
|
|||
pSubplan->execNode.nodeId = MNODE_HANDLE;
|
||||
pSubplan->execNode.epSet = pCxt->pPlanCxt->mgmtEpSet;
|
||||
}
|
||||
if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_DNODE_VARIABLES)) {
|
||||
if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_DNODE_VARIABLES) && pScanLogicNode->pVgroupList) {
|
||||
pScan->mgmtEpSet = pScanLogicNode->pVgroupList->vgroups->epSet;
|
||||
} else {
|
||||
pScan->mgmtEpSet = pCxt->pPlanCxt->mgmtEpSet;
|
||||
|
|
|
@ -1132,7 +1132,9 @@ static int32_t stbSplAggNodeCreateMerge(SSplitContext* pCtx, SStableSplitInfo* p
|
|||
}
|
||||
}
|
||||
}
|
||||
code = stbSplCreateMergeNode(pCtx, NULL, pInfo->pSplitNode, pMergeKeys, pChildAgg, groupSort, true);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = stbSplCreateMergeNode(pCtx, NULL, pInfo->pSplitNode, pMergeKeys, pChildAgg, groupSort, true);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code && sortForGroup) {
|
||||
SMergeLogicNode* pMerge =
|
||||
(SMergeLogicNode*)nodesListGetNode(pInfo->pSplitNode->pChildren, LIST_LENGTH(pInfo->pSplitNode->pChildren) - 1);
|
||||
|
|
Loading…
Reference in New Issue