From 906fafc578912c9621414153601d8c5f49c0322a Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 23 Nov 2022 12:58:27 +0800 Subject: [PATCH] enh: last cache optimize --- source/libs/planner/src/planLogicCreater.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index dc28b2ba31..de0feceb8f 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -560,13 +560,9 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, } if (NULL != pSelect->pGroupByList) { - if (NULL != pAgg->pGroupKeys) { - code = nodesListStrictAppendList(pAgg->pGroupKeys, nodesCloneList(pSelect->pGroupByList)); - } else { - pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList); - if (NULL == pAgg->pGroupKeys) { - code = TSDB_CODE_OUT_OF_MEMORY; - } + pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList); + if (NULL == pAgg->pGroupKeys) { + code = TSDB_CODE_OUT_OF_MEMORY; } } @@ -587,6 +583,8 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, if (TSDB_CODE_SUCCESS == code && NULL != pOutputGroupKeys) { code = createColumnByRewriteExprs(pOutputGroupKeys, &pAgg->node.pTargets); } + nodesDestroyList(pOutputGroupKeys); + if (TSDB_CODE_SUCCESS == code && NULL != pAgg->pAggFuncs) { code = createColumnByRewriteExprs(pAgg->pAggFuncs, &pAgg->node.pTargets); } -- GitLab