From 4fcbc1123ddae674b9893e53f50375d5561d1f3c Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sat, 29 Feb 2020 15:41:40 +0800 Subject: [PATCH] add test case script for sliding query --- src/system/detail/src/vnodeQueryImpl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/system/detail/src/vnodeQueryImpl.c b/src/system/detail/src/vnodeQueryImpl.c index f12db0971e..d748a3cd11 100644 --- a/src/system/detail/src/vnodeQueryImpl.c +++ b/src/system/detail/src/vnodeQueryImpl.c @@ -1785,7 +1785,19 @@ static int32_t getNextQualifiedWindow(SQueryRuntimeEnv *pRuntimeEnv, STimeWindow return -1; } - TSKEY startKey = QUERY_IS_ASC_QUERY(pQuery) ? pNextWin->skey : pNextWin->ekey; + TSKEY startKey = -1; + if (QUERY_IS_ASC_QUERY(pQuery)) { + startKey = pNextWin->skey; + if (startKey < pQuery->skey) { + startKey = pQuery->skey; + } + } else { + startKey = pNextWin->ekey; + if (startKey > pQuery->skey) { + startKey = pQuery->skey; + } + } + int32_t startPos = searchFn((char *)primaryKeys, pBlockInfo->size, startKey, pQuery->order.order); /* @@ -6345,6 +6357,7 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) { int64_t skey = pQuery->lastKey; int32_t status = pQuery->over; + int32_t activeSlot = pRuntimeEnv->windowResInfo.curIndex; SET_MASTER_SCAN_FLAG(pRuntimeEnv); int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); @@ -6370,6 +6383,7 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) { status = pQuery->over; pQuery->ekey = pQuery->lastKey - step; pQuery->lastKey = pQuery->skey; + pRuntimeEnv->windowResInfo.curIndex = activeSlot; setQueryStatus(pQuery, QUERY_NOT_COMPLETED); pRuntimeEnv->scanFlag = REPEAT_SCAN; -- GitLab