From 431945fa2def3ed582d35a51846136cf9516df55 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 21 Jul 2020 00:37:12 +0800 Subject: [PATCH] [td-225] fix bugs in query. --- src/query/inc/qResultbuf.h | 1 - src/tsdb/src/tsdbRead.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/query/inc/qResultbuf.h b/src/query/inc/qResultbuf.h index d9da6bb63e..e8b3af7ccf 100644 --- a/src/query/inc/qResultbuf.h +++ b/src/query/inc/qResultbuf.h @@ -37,7 +37,6 @@ typedef struct SDiskbasedResultBuf { int32_t numOfPages; int64_t totalBufSize; FILE* file; -// int32_t fd; // data file fd int32_t allocateId; // allocated page id int32_t incStep; // minimum allocated pages void* pBuf; // mmap buffer pointer diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 3eeca85db7..71d3fd9cc4 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -995,6 +995,8 @@ static void getQualifiedRowsPos(STsdbQueryHandle* pQueryHandle, int32_t startPos int32_t remain = endPos - startPos + 1; if (remain + numOfExisted > pQueryHandle->outputCapacity) { *end = (pQueryHandle->outputCapacity - numOfExisted) + startPos - 1; + } else { + *end = endPos; } *start = startPos; @@ -1002,6 +1004,8 @@ static void getQualifiedRowsPos(STsdbQueryHandle* pQueryHandle, int32_t startPos int32_t remain = (startPos - endPos) + 1; if (remain + numOfExisted > pQueryHandle->outputCapacity) { *end = startPos + 1 - (pQueryHandle->outputCapacity - numOfExisted); + } else { + *end = endPos; } *start = *end; -- GitLab