From aa791c1bb02f66ad3c34448470dd2271022712a7 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Mon, 22 Jul 2024 13:38:04 +0800 Subject: [PATCH] fix nodes ret check --- source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/parser/src/parTranslater.c | 10 ++++++---- source/libs/planner/src/planLogicCreater.c | 8 ++++---- source/libs/planner/src/planPhysiCreater.c | 5 +---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 2b2c260138..78cf78f6db 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -1083,5 +1083,6 @@ int32_t nodesCloneList(const SNodeList* pList, SNodeList** ppList) { return code; } } + *ppList = pDst; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2703a2998d..75269f2707 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8368,6 +8368,7 @@ static int32_t createRollupFuncs(SCreateTableStmt* pStmt, SNodeList** ppList) { } } } + *ppList = pFuncs; return code;; } @@ -12760,14 +12761,14 @@ static int32_t rewriteShowTags(STranslateContext* pCxt, SQuery* pQuery) { return code; } -static int32_t createTagsFunction(SNode** ppNode) { +static int32_t createTagsFunction(SFunctionNode** ppNode) { SFunctionNode* pFunc = NULL; int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } strcpy(pFunc->functionName, "_tags"); - *ppNode = (SNode*)pFunc; + *ppNode = pFunc; return code; } @@ -12781,11 +12782,12 @@ static int32_t createShowTableTagsProjections(SNodeList** pProjections, SNodeLis if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(pProjections, (SNode*)pTbNameFunc); } + SFunctionNode* pTagsFunc = NULL; if (TSDB_CODE_SUCCESS == code) { - code = createTbnameFunction(&pTbNameFunc); + code = createTagsFunction(&pTagsFunc); } if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(*pProjections, (SNode*)pTbNameFunc); + code = nodesListStrictAppend(*pProjections, (SNode*)pTagsFunc); } return code; } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index e727c4227b..998f2cd2f4 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1013,7 +1013,7 @@ static int32_t createWindowLogicNodeByState(SLogicPlanContext* pCxt, SStateWindo pCxt->pPlanCxt->streamQuery ? DATA_ORDER_LEVEL_GLOBAL : pWindow->node.requireDataOrder; pWindow->pStateExpr = NULL; code = nodesCloneNode(pState->pExpr, &pWindow->pStateExpr); - if (TSDB_CODE_SUCCESS == code) { + if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode((SNode*)pWindow); return code; } @@ -1231,13 +1231,13 @@ static int32_t partFillExprs(SSelectStmt* pSelect, SNodeList** pFillExprs, SNode SNode* pExpr = ((SOrderByExprNode*)pOrderExpr)->pExpr; if (needFillValue(pExpr)) { SNode* pNew = NULL; - code = nodesCloneNode(pProject, &pExpr); + code = nodesCloneNode(pExpr, &pNew); if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(pFillExprs, pNew); } } else if (QUERY_NODE_VALUE != nodeType(pExpr)) { SNode* pNew = NULL; - code = nodesCloneNode(pProject, &pExpr); + code = nodesCloneNode(pExpr, &pNew); if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(pNotFillExprs, pNew); } @@ -1293,7 +1293,7 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pFill->pValues = NULL; code = nodesCloneNode(pFillNode->pValues, &pFill->pValues); if (TSDB_CODE_SUCCESS == code) { - code = nodesCloneNode(pFillNode->pWStartTs, &pFillNode->pWStartTs); + code = nodesCloneNode(pFillNode->pWStartTs, &pFill->pWStartTs); } if (TSDB_CODE_SUCCESS == code && 0 == LIST_LENGTH(pFill->node.pTargets)) { diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 584cefe4d3..c4c9f358fa 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -2404,10 +2404,7 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren } if (TSDB_CODE_SUCCESS == code && NULL != pFillNode->pValues) { - code = nodesCloneNode(pFillNode->pValues, &pFillNode->pValues); - if (NULL == pFill->pValues) { - code = code; - } + code = nodesCloneNode(pFillNode->pValues, &pFill->pValues); } if (TSDB_CODE_SUCCESS == code) {