From 0f97c36acb6df5a87330989f3a6c6d9297d7e54b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 21 Jun 2022 09:54:06 +0800 Subject: [PATCH] feat: group by tags optimize --- source/libs/planner/src/planOptimizer.c | 4 ++-- source/libs/planner/src/planPhysiCreater.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index d052a3d654..5249bd913d 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1057,9 +1057,9 @@ static bool partTagsOptHasCol(SNodeList* pPartKeys) { } static bool partTagsIsOptimizableNode(SLogicNode* pNode) { - return ((QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode) || + return ((QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode) /*|| (QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode) && NULL != ((SAggLogicNode*)pNode)->pGroupKeys && - NULL != ((SAggLogicNode*)pNode)->pAggFuncs)) && + NULL != ((SAggLogicNode*)pNode)->pAggFuncs)*/) && 1 == LIST_LENGTH(pNode->pChildren) && QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(nodesListGetNode(pNode->pChildren, 0))); } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 4d4763c606..ff78370c52 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -883,12 +883,15 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh pInterpFunc->interval = pFuncLogicNode->interval; pInterpFunc->fillMode = pFuncLogicNode->fillMode; pInterpFunc->pFillValues = nodesCloneNode(pFuncLogicNode->pFillValues); - pInterpFunc->pTimeSeries = nodesCloneNode(pFuncLogicNode->pTimeSeries); - if (NULL == pInterpFunc->pTimeSeries || (NULL != pFuncLogicNode->pFillValues && NULL == pInterpFunc->pFillValues)) { + if (NULL != pFuncLogicNode->pFillValues && NULL == pInterpFunc->pFillValues) { code = TSDB_CODE_OUT_OF_MEMORY; } } + if (TSDB_CODE_SUCCESS == code) { + code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pFuncLogicNode->pTimeSeries, &pInterpFunc->pTimeSeries); + } + if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pInterpFunc; } else { -- GitLab