From bae6d824c2576e9fcc84ebade3992b6f93adb8f8 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 29 Oct 2022 12:54:39 +0800 Subject: [PATCH] fix(query): init blockscanInfo correctly. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 17 ++++++++++------- tests/system-test/2-query/interp.py | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 5e5e287cf9..9add18a4dc 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3478,6 +3478,7 @@ static int32_t doOpenReaderImpl(STsdbReader* pReader) { initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader); resetDataBlockIterator(&pReader->status.blockIter, pReader->order); +// resetDataBlockScanInfo(pReader->status.pTableMap, pReader->window.skey); // no data in files, let's try buffer in memory if (pReader->status.fileIter.numOfFiles == 0) { @@ -3731,13 +3732,6 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { if (pReader->innerReader[0] != NULL && pReader->step == 0) { bool ret = doTsdbNextDataBlock(pReader->innerReader[0]); - - // prepare for the main scan - int32_t code = doOpenReaderImpl(pReader); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - pReader->step = EXTERNAL_ROWS_PREV; if (ret) { return ret; @@ -3745,6 +3739,14 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { } if (pReader->step == EXTERNAL_ROWS_PREV) { + // prepare for the main scan + int32_t code = doOpenReaderImpl(pReader); + resetDataBlockScanInfo(pReader->status.pTableMap, pReader->innerReader[0]->window.ekey); + + if (code != TSDB_CODE_SUCCESS) { + return code; + } + pReader->step = EXTERNAL_ROWS_MAIN; } @@ -3756,6 +3758,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { if (pReader->innerReader[1] != NULL && pReader->step == EXTERNAL_ROWS_MAIN) { // prepare for the next row scan int32_t code = doOpenReaderImpl(pReader->innerReader[1]); + resetDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey); if (code != TSDB_CODE_SUCCESS) { return code; } diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index bee20710b5..71501d5967 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -11,7 +11,7 @@ class TDTestCase: def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), True) def run(self): dbname = "db" -- GitLab