From e00d0728872db857a7b4eb6ce5c92ae3d1e503c3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 10 Aug 2020 17:38:09 +0800 Subject: [PATCH] [td-1101] add time range check, fix bugs for projection query. --- src/query/src/qExecutor.c | 5 +++++ src/tsdb/src/tsdbRead.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 1277e7bfbb..a08a5476e3 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1342,6 +1342,11 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl if ((pQuery->limit.limit >= 0) && (pQuery->limit.limit + pQuery->limit.offset) <= numOfRes) { setQueryStatus(pQuery, QUERY_COMPLETED); } + + if (((pTableQInfo->lastKey > pTableQInfo->win.ekey) && QUERY_IS_ASC_QUERY(pQuery)) || + ((pTableQInfo->lastKey < pTableQInfo->win.ekey) && (!QUERY_IS_ASC_QUERY(pQuery)))) { + setQueryStatus(pQuery, QUERY_COMPLETED); + } } } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 2e9520c360..d40084be23 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -196,9 +196,9 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab assert(sizeOfGroup >= 1 && pCond != NULL && pCond->numOfCols > 0); if (ASCENDING_TRAVERSE(pCond->order)) { - assert(pQueryHandle->window.skey >= pQueryHandle->window.ekey); - } else { assert(pQueryHandle->window.skey <= pQueryHandle->window.ekey); + } else { + assert(pQueryHandle->window.skey >= pQueryHandle->window.ekey); } // allocate buffer in order to load data blocks from file -- GitLab