From e1140d4c1566973cbb5b32d28c0a2226b9de0fff Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 9 May 2023 15:05:41 +0800 Subject: [PATCH] optimize duplicate timestamp check --- source/libs/executor/src/timesliceoperator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 78aabb5c26..f54f54be37 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -176,6 +176,10 @@ static bool checkDuplicateTimestamps(STimeSliceOperatorInfo* pSliceInfo, SColumn int64_t currentTs = *(int64_t*)colDataGetData(pTsCol, curIndex); + if (currentTs > pSliceInfo->win.ekey) { + return false; + } + if ((pSliceInfo->prevTsSet == true) && (currentTs == pSliceInfo->prevTs)) { return true; } @@ -183,7 +187,7 @@ static bool checkDuplicateTimestamps(STimeSliceOperatorInfo* pSliceInfo, SColumn pSliceInfo->prevTsSet = true; pSliceInfo->prevTs = currentTs; - if (curIndex < rows - 1) { + if (currentTs == pSliceInfo->win.ekey && curIndex < rows - 1) { int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, curIndex + 1); if (currentTs == nextTs) { return true;