From 341112923b872296b40f0e12b333e2eb97cee14e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 6 Nov 2022 23:42:04 +0800 Subject: [PATCH] fix(query): init filter in group operator. --- source/libs/executor/inc/executorimpl.h | 5 +---- source/libs/executor/src/groupoperator.c | 8 ++++++-- source/libs/executor/src/joinoperator.c | 2 +- source/libs/executor/src/projectoperator.c | 2 +- source/libs/executor/src/sortoperator.c | 2 +- source/libs/executor/src/tfill.c | 2 +- source/libs/executor/src/timewindowoperator.c | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 50b44d6524..d29c736019 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -621,10 +621,8 @@ typedef struct SIndefOperatorInfo { SAggSupporter aggSup; SArray* pPseudoColInfo; SExprSupp scalarSup; - SNode* pCondition; uint64_t groupId; - - SSDataBlock* pNextGroupRes; + SSDataBlock* pNextGroupRes; } SIndefOperatorInfo; typedef struct SFillOperatorInfo { @@ -649,7 +647,6 @@ typedef struct SGroupbyOperatorInfo { SAggSupporter aggSup; SArray* pGroupCols; // group by columns, SArray SArray* pGroupColVals; // current group column values, SArray - SNode* pCondition; bool isInit; // denote if current val is initialized or not char* keyBuf; // group by keys for hash int32_t groupKeyLen; // total group by column width diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 88f9ad382d..b68c606ec6 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "filter.h" #include "function.h" #include "os.h" #include "tname.h" @@ -414,8 +415,6 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* } pInfo->pGroupCols = extractColumnInfo(pAggNode->pGroupKeys); - pInfo->pCondition = pAggNode->node.pConditions; - int32_t code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, numOfScalarExpr); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -434,6 +433,11 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* goto _error; } + code = filterInitFromNode((SNode*)pAggNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + initResultRowInfo(&pInfo->binfo.resultRowInfo); pOperator->name = "GroupbyAggOperator"; diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 11c4ee5141..45d76dce74 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include +#include "filter.h" #include "executorimpl.h" #include "function.h" #include "os.h" diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index c5fbee973d..fa469eb77b 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include +#include "filter.h" #include "executorimpl.h" #include "functionMgt.h" diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 29264328ce..a50d1c0ea4 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include +#include "filter.h" #include "executorimpl.h" #include "tdatablock.h" diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 0c106a0d2a..ebc3a962d3 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include +#include "filter.h" #include "os.h" #include "query.h" #include "taosdef.h" diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 1eb5890ece..0bcecf32e4 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -12,7 +12,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include +#include "filter.h" #include "executorimpl.h" #include "function.h" #include "functionMgt.h" -- GitLab