提交 cf46b222 编写于 作者: H Haojun Liao

fix(query): fix error in tsdbread.

上级 6f252d8d
...@@ -177,6 +177,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t ...@@ -177,6 +177,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
(*pIter)->iSttBlk = index; (*pIter)->iSttBlk = index;
if (index != -1) { if (index != -1) {
(*pIter)->pSttBlk = taosArrayGet(pBlockLoadInfo->aSttBlk, (*pIter)->iSttBlk); (*pIter)->pSttBlk = taosArrayGet(pBlockLoadInfo->aSttBlk, (*pIter)->iSttBlk);
(*pIter)->iRow = ((*pIter)->backward) ? (*pIter)->pSttBlk->nRow : -1;
} }
_exit: _exit:
...@@ -306,7 +307,6 @@ bool tLDataIterNextRow(SLDataIter *pIter) { ...@@ -306,7 +307,6 @@ bool tLDataIterNextRow(SLDataIter *pIter) {
int32_t iBlockL = pIter->iSttBlk; int32_t iBlockL = pIter->iSttBlk;
SBlockData *pBlockData = loadBlockIfMissing(pIter); SBlockData *pBlockData = loadBlockIfMissing(pIter);
pIter->iRow += step; pIter->iRow += step;
while (1) { while (1) {
...@@ -323,6 +323,7 @@ bool tLDataIterNextRow(SLDataIter *pIter) { ...@@ -323,6 +323,7 @@ bool tLDataIterNextRow(SLDataIter *pIter) {
if (iBlockL != pIter->iSttBlk) { if (iBlockL != pIter->iSttBlk) {
pBlockData = loadBlockIfMissing(pIter); pBlockData = loadBlockIfMissing(pIter);
pIter->iRow += step;
} }
} }
......
...@@ -228,9 +228,11 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK ...@@ -228,9 +228,11 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
for (int32_t j = 0; j < numOfTables; ++j) { for (int32_t j = 0; j < numOfTables; ++j) {
STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid}; STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid};
if (ASCENDING_TRAVERSE(pTsdbReader->order)) { if (ASCENDING_TRAVERSE(pTsdbReader->order)) {
info.lastKey = pTsdbReader->window.skey - 1; int64_t skey = pTsdbReader->window.skey;
info.lastKey = (skey > INT64_MIN)? (skey - 1):skey;
} else { } else {
info.lastKey = pTsdbReader->window.ekey + 1; int64_t ekey = pTsdbReader->window.ekey;
info.lastKey = (ekey < INT64_MAX)? (ekey + 1):ekey;
} }
taosHashPut(pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info)); taosHashPut(pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info));
...@@ -342,10 +344,12 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, STsdb ...@@ -342,10 +344,12 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, STsdb
pLReader->uid = 0; pLReader->uid = 0;
tMergeTreeClose(&pLReader->mergeTree); tMergeTreeClose(&pLReader->mergeTree);
pLReader->pInfo = tCreateLastBlockLoadInfo();
if (pLReader->pInfo == NULL) { if (pLReader->pInfo == NULL) {
tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr); pLReader->pInfo = tCreateLastBlockLoadInfo();
return terrno; if (pLReader->pInfo == NULL) {
tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr);
return terrno;
}
} }
tsdbDebug("init fileset iterator, total files:%d %s", pIter->numOfFiles, pReader->idStr); tsdbDebug("init fileset iterator, total files:%d %s", pIter->numOfFiles, pReader->idStr);
...@@ -1892,7 +1896,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan ...@@ -1892,7 +1896,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
int32_t code = int32_t code =
tMergeTreeOpen(&pLBlockReader->mergeTree, (pLBlockReader->order == TSDB_ORDER_DESC), pReader->pFileReader, tMergeTreeOpen(&pLBlockReader->mergeTree, (pLBlockReader->order == TSDB_ORDER_DESC), pReader->pFileReader,
pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo); pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
return false; return false;
} }
......
...@@ -97,6 +97,7 @@ while $loop <= $loops ...@@ -97,6 +97,7 @@ while $loop <= $loops
endw endw
sql select count(*) from $stb sql select count(*) from $stb
if $data00 != $totalNum then if $data00 != $totalNum then
print expect $totalNum , actual: $data00
return -1 return -1
endi endi
$loop = $loop + 1 $loop = $loop + 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册