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

View File

@ -27,6 +27,7 @@ typedef struct SProjectOperatorInfo {
SLimitInfo limitInfo; SLimitInfo limitInfo;
bool mergeDataBlocks; bool mergeDataBlocks;
SSDataBlock* pFinalRes; SSDataBlock* pFinalRes;
bool inputIgnoreGroupId;
} SProjectOperatorInfo; } SProjectOperatorInfo;
typedef struct SIndefOperatorInfo { typedef struct SIndefOperatorInfo {
@ -299,6 +300,10 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
pBlock->info.type == STREAM_CHECKPOINT) { pBlock->info.type == STREAM_CHECKPOINT) {
return pBlock; return pBlock;
} }
if (pProjectInfo->inputIgnoreGroupId) {
pBlock->info.id.groupId = 0;
}
int32_t status = discardGroupDataBlock(pBlock, pLimitInfo); int32_t status = discardGroupDataBlock(pBlock, pLimitInfo);
if (status == PROJECT_RETRIEVE_CONTINUE) { 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) { NULL != pChild->pConditions || NULL != pChild->pLimit || NULL != pChild->pSlimit) {
return false; return false;
} }
if (false == ((SProjectLogicNode*)pChild)->ignoreGroupId) {
qError("internal error, child project output does not ignore group id");
return false;
}
return true; return true;
} }
@ -3036,6 +3040,7 @@ static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan*
NODES_CLEAR_LIST(pChild->pChildren); NODES_CLEAR_LIST(pChild->pChildren);
} }
nodesDestroyNode((SNode*)pChild); nodesDestroyNode((SNode*)pChild);
((SProjectLogicNode*)pSelfNode)->inputIgnoreGroup = true;
pCxt->optimized = true; pCxt->optimized = true;
return code; return code;
} }