fix: set ignore input group id

This commit is contained in:
shenglian zhou 2024-01-15 11:58:29 +08:00
parent 8be7fee439
commit 8ae3aa24be
3 changed files with 12 additions and 0 deletions

View File

@ -155,6 +155,7 @@ typedef struct SProjectLogicNode {
SNodeList* pProjections;
char stmtName[TSDB_TABLE_NAME_LEN];
bool ignoreGroupId;
bool inputIgnoreGroup;
} SProjectLogicNode;
typedef struct SIndefRowsFuncLogicNode {
@ -447,6 +448,7 @@ typedef struct SProjectPhysiNode {
SNodeList* pProjections;
bool mergeDataBlock;
bool ignoreGroupId;
bool inputIgnoreGroupId;
} SProjectPhysiNode;
typedef struct SIndefRowsFuncPhysiNode {

View File

@ -27,6 +27,7 @@ typedef struct SProjectOperatorInfo {
SLimitInfo limitInfo;
bool mergeDataBlocks;
SSDataBlock* pFinalRes;
bool inputIgnoreGroupId;
} SProjectOperatorInfo;
typedef struct SIndefOperatorInfo {
@ -299,6 +300,10 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
pBlock->info.type == STREAM_CHECKPOINT) {
return pBlock;
}
if (pProjectInfo->inputIgnoreGroupId) {
pBlock->info.id.groupId = 0;
}
int32_t status = discardGroupDataBlock(pBlock, pLimitInfo);
if (status == PROJECT_RETRIEVE_CONTINUE) {

View File

@ -2980,6 +2980,10 @@ static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) {
NULL != pChild->pConditions || NULL != pChild->pLimit || NULL != pChild->pSlimit) {
return false;
}
if (false == ((SProjectLogicNode*)pChild)->ignoreGroupId) {
qError("internal error, child project output does not ignore group id");
return false;
}
return true;
}
@ -3036,6 +3040,7 @@ static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan*
NODES_CLEAR_LIST(pChild->pChildren);
}
nodesDestroyNode((SNode*)pChild);
((SProjectLogicNode*)pSelfNode)->inputIgnoreGroup = true;
pCxt->optimized = true;
return code;
}