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) {
|
if (msg) {
|
||||||
int8_t inputType = RSMA_EXEC_MSG_TYPE(msg);
|
int8_t inputType = RSMA_EXEC_MSG_TYPE(msg);
|
||||||
if (inputType == STREAM_INPUT__DATA_SUBMIT) {
|
if (inputType == STREAM_INPUT__DATA_SUBMIT) {
|
||||||
if (nDelete > 0) {
|
|
||||||
resume = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_resume_submit:
|
_resume_submit:
|
||||||
packData.msgLen = RSMA_EXEC_MSG_LEN(msg);
|
packData.msgLen = RSMA_EXEC_MSG_LEN(msg);
|
||||||
packData.ver = RSMA_EXEC_MSG_VER(msg);
|
packData.ver = RSMA_EXEC_MSG_VER(msg);
|
||||||
|
@ -1549,10 +1545,6 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
||||||
}
|
}
|
||||||
++nSubmit;
|
++nSubmit;
|
||||||
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||||
if (nSubmit > 0) {
|
|
||||||
resume = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_resume_delete:
|
_resume_delete:
|
||||||
version = RSMA_EXEC_MSG_VER(msg);
|
version = RSMA_EXEC_MSG_VER(msg);
|
||||||
if ((terrno = tqExtractDelDataBlock(RSMA_EXEC_MSG_BODY(msg), RSMA_EXEC_MSG_LEN(msg), version,
|
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;
|
goto _rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resume == 1) {
|
if (resume == 2) {
|
||||||
resume = 0;
|
|
||||||
goto _resume_submit;
|
|
||||||
} else if (resume == 2) {
|
|
||||||
resume = 0;
|
resume = 0;
|
||||||
goto _resume_delete;
|
goto _resume_delete;
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,12 +488,12 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pLogicNode = (SLogicNode*)pScan;
|
*pLogicNode = (SLogicNode*)pScan;
|
||||||
} else {
|
|
||||||
nodesDestroyNode((SNode*)pScan);
|
|
||||||
}
|
|
||||||
pScan->paraTablesSort = getParaTablesSortOptHint(pSelect->pHint);
|
pScan->paraTablesSort = getParaTablesSortOptHint(pSelect->pHint);
|
||||||
pScan->smallDataTsSort = getSmallDataTsSortOptHint(pSelect->pHint);
|
pScan->smallDataTsSort = getSmallDataTsSortOptHint(pSelect->pHint);
|
||||||
pCxt->hasScan = true;
|
pCxt->hasScan = true;
|
||||||
|
} else {
|
||||||
|
nodesDestroyNode((SNode*)pScan);
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -738,11 +738,13 @@ static int32_t addWinJoinPrimKeyToAggFuncs(SSelectStmt* pSelect, SNodeList** pLi
|
||||||
pProbeTable = (SRealTableNode*)pJoinTable->pRight;
|
pProbeTable = (SRealTableNode*)pJoinTable->pRight;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (!*pList) nodesDestroyList(pTargets);
|
||||||
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
|
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
|
||||||
if (NULL == pCol) {
|
if (NULL == pCol) {
|
||||||
|
if (!*pList) nodesDestroyList(pTargets);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1598,10 +1598,6 @@ static int32_t pdcRewriteTypeBasedOnJoinRes(SOptimizeContext* pCxt, SJoinLogicNo
|
||||||
tSimpleHashCleanup(pLeftTables);
|
tSimpleHashCleanup(pLeftTables);
|
||||||
tSimpleHashCleanup(pRightTables);
|
tSimpleHashCleanup(pRightTables);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (pJoin->joinType) {
|
switch (pJoin->joinType) {
|
||||||
case JOIN_TYPE_LEFT:
|
case JOIN_TYPE_LEFT:
|
||||||
if (tableResNonNull[1] && !tableResOp[0]) {
|
if (tableResNonNull[1] && !tableResOp[0]) {
|
||||||
|
@ -2156,17 +2152,11 @@ static int32_t sortPriKeyOptHandleLeftRightJoinSort(SJoinLogicNode* pJoin, SSort
|
||||||
if (sortByProbe) {
|
if (sortByProbe) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pNotOptimize = true;
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
case JOIN_STYPE_ANTI: {
|
case JOIN_STYPE_ANTI: {
|
||||||
if (sortByProbe) {
|
if (sortByProbe) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
*keepSort = false;
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
case JOIN_STYPE_ASOF:
|
case JOIN_STYPE_ASOF:
|
||||||
case JOIN_STYPE_WIN: {
|
case JOIN_STYPE_WIN: {
|
||||||
|
@ -2176,9 +2166,6 @@ static int32_t sortPriKeyOptHandleLeftRightJoinSort(SJoinLogicNode* pJoin, SSort
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pNotOptimize = true;
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||||
|
@ -3279,7 +3266,7 @@ static EDealRes eliminateProjOptRewriteScanTableAlias(SNode* pNode, void* pConte
|
||||||
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
|
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
|
||||||
SColumnNode* pCol = (SColumnNode*)pNode;
|
SColumnNode* pCol = (SColumnNode*)pNode;
|
||||||
RewriteTableAliasCxt* pCtx = (RewriteTableAliasCxt*)pContext;
|
RewriteTableAliasCxt* pCtx = (RewriteTableAliasCxt*)pContext;
|
||||||
strcpy(pCol->tableAlias, pCtx->newTableAlias);
|
strncpy(pCol->tableAlias, pCtx->newTableAlias, TSDB_TABLE_NAME_LEN);
|
||||||
}
|
}
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -3288,12 +3275,13 @@ static EDealRes eliminateProjOptRewriteScanTableAlias(SNode* pNode, void* pConte
|
||||||
static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan,
|
static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan,
|
||||||
SProjectLogicNode* pProjectNode) {
|
SProjectLogicNode* pProjectNode) {
|
||||||
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0);
|
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0);
|
||||||
SNodeList* pNewChildTargets = nodesMakeList();
|
|
||||||
|
|
||||||
if (NULL == pProjectNode->node.pParent) {
|
if (NULL == pProjectNode->node.pParent) {
|
||||||
|
SNodeList* pNewChildTargets = nodesMakeList();
|
||||||
SNode * pProjection = NULL, *pChildTarget = NULL;
|
SNode * pProjection = NULL, *pChildTarget = NULL;
|
||||||
bool needOrderMatch = QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pChild) && ((SProjectLogicNode*)pChild)->isSetOpProj;
|
|
||||||
bool orderMatch = true;
|
bool orderMatch = true;
|
||||||
|
bool needOrderMatch =
|
||||||
|
QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pChild) && ((SProjectLogicNode*)pChild)->isSetOpProj;
|
||||||
if (needOrderMatch) {
|
if (needOrderMatch) {
|
||||||
// For sql: select ... from (select ... union all select ...);
|
// 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
|
// 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);
|
nodesDestroyList(pScan->node.pTargets);
|
||||||
pScan->node.pTargets = NULL;
|
pScan->node.pTargets = NULL;
|
||||||
SNodeListNode* list = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST);
|
SNodeListNode* list = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST);
|
||||||
|
if (!list) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
list->pNodeList = pFunc;
|
list->pNodeList = pFunc;
|
||||||
code = nodesCollectColumnsFromNode((SNode*)list, NULL, COLLECT_COL_TYPE_COL, &pScan->pScanCols);
|
code = nodesCollectColumnsFromNode((SNode*)list, NULL, COLLECT_COL_TYPE_COL, &pScan->pScanCols);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
@ -4674,6 +4663,7 @@ static bool pushDownLimitTo(SLogicNode* pNodeWithLimit, SLogicNode* pNodeLimitPu
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case QUERY_NODE_LOGIC_PLAN_JOIN: {
|
case QUERY_NODE_LOGIC_PLAN_JOIN: {
|
||||||
cloneLimit(pNodeWithLimit, pNodeLimitPushTo, CLONE_LIMIT);
|
cloneLimit(pNodeWithLimit, pNodeLimitPushTo, CLONE_LIMIT);
|
||||||
break;
|
break;
|
||||||
|
@ -5028,7 +5018,7 @@ _return:
|
||||||
|
|
||||||
if (!res && DATA_ORDER_LEVEL_NONE == pJoin->node.requireDataOrder) {
|
if (!res && DATA_ORDER_LEVEL_NONE == pJoin->node.requireDataOrder) {
|
||||||
pJoin->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL;
|
pJoin->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL;
|
||||||
adjustLogicNodeDataRequirement(pNode, pJoin->node.requireDataOrder);
|
(void)adjustLogicNodeDataRequirement(pNode, pJoin->node.requireDataOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -695,7 +695,7 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
|
||||||
pSubplan->execNode.nodeId = MNODE_HANDLE;
|
pSubplan->execNode.nodeId = MNODE_HANDLE;
|
||||||
pSubplan->execNode.epSet = pCxt->pPlanCxt->mgmtEpSet;
|
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;
|
pScan->mgmtEpSet = pScanLogicNode->pVgroupList->vgroups->epSet;
|
||||||
} else {
|
} else {
|
||||||
pScan->mgmtEpSet = pCxt->pPlanCxt->mgmtEpSet;
|
pScan->mgmtEpSet = pCxt->pPlanCxt->mgmtEpSet;
|
||||||
|
|
|
@ -1132,7 +1132,9 @@ static int32_t stbSplAggNodeCreateMerge(SSplitContext* pCtx, SStableSplitInfo* p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = stbSplCreateMergeNode(pCtx, NULL, pInfo->pSplitNode, pMergeKeys, pChildAgg, groupSort, true);
|
code = stbSplCreateMergeNode(pCtx, NULL, pInfo->pSplitNode, pMergeKeys, pChildAgg, groupSort, true);
|
||||||
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && sortForGroup) {
|
if (TSDB_CODE_SUCCESS == code && sortForGroup) {
|
||||||
SMergeLogicNode* pMerge =
|
SMergeLogicNode* pMerge =
|
||||||
(SMergeLogicNode*)nodesListGetNode(pInfo->pSplitNode->pChildren, LIST_LENGTH(pInfo->pSplitNode->pChildren) - 1);
|
(SMergeLogicNode*)nodesListGetNode(pInfo->pSplitNode->pChildren, LIST_LENGTH(pInfo->pSplitNode->pChildren) - 1);
|
||||||
|
|
Loading…
Reference in New Issue