From 9cddf06053bc5c74a4e63d2f577c4d04a6c6736e Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 16 Jun 2023 16:11:56 +0800 Subject: [PATCH] handle 0 result case for groups --- source/libs/executor/src/timesliceoperator.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index b0c08ee0b8..5c01775a17 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -875,7 +875,13 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { if (pSliceInfo->pRemainRes == NULL) { pSliceInfo->pNextGroupRes = NULL; } - goto _finished; + if (pResBlock->info.rows != 0) { + goto _finished; + } else { + // after fillter if result block has 0 rows, go back to + // process pNextGroupRes again for unfinished data + continue; + } } pSliceInfo->pNextGroupRes = NULL; } @@ -900,7 +906,9 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { doHandleTimeslice(pOperator, pBlock); if (checkWindowBoundReached(pSliceInfo) || checkThresholdReached(pSliceInfo, pOperator->resultInfo.threshold)) { doFilter(pResBlock, pOperator->exprSupp.pFilterInfo, NULL); - goto _finished; + if (pResBlock->info.rows != 0) { + goto _finished; + } } } // post work for a specific group @@ -916,8 +924,8 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { // restore initial value for next group resetTimesliceInfo(pSliceInfo); - if (checkThresholdReached(pSliceInfo, pOperator->resultInfo.threshold)) { - goto _finished; + if (pResBlock->info.rows != 0) { + break; } }