未验证 提交 0ea1d145 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19101 from taosdata/feature/3_liaohj

fix(query): set start row index for desc scan.
......@@ -158,9 +158,9 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
pBlock, el, idStr);
pInfo->blockIndex[pInfo->currentLoadBlockIndex] = pIter->iSttBlk;
tsdbDebug("last block index list:%d, %d, %s", pInfo->blockIndex[0], pInfo->blockIndex[1], idStr);
pIter->iRow = (pIter->backward) ? pInfo->blockData[pInfo->currentLoadBlockIndex].nRow : -1;
tsdbDebug("last block index list:%d, %d, rowIndex:%d %s", pInfo->blockIndex[0], pInfo->blockIndex[1], pIter->iRow, idStr);
return &pInfo->blockData[pInfo->currentLoadBlockIndex];
_exit:
......@@ -419,6 +419,7 @@ static void findNextValidRow(SLDataIter *pIter, const char *idStr) {
pBlockData->aUid != NULL) {
i = binarySearchForStartRowIndex((uint64_t *)pBlockData->aUid, pBlockData->nRow, pIter->uid, pIter->backward);
if (i == -1) {
tsdbDebug("failed to find the data in pBlockData, uid:%"PRIu64" , %s", pIter->uid, idStr);
pIter->iRow = -1;
return;
}
......@@ -500,7 +501,12 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) {
if (iBlockL != pIter->iSttBlk) {
pBlockData = loadLastBlock(pIter, idStr);
pIter->iRow += step;
if (pBlockData == NULL) {
goto _exit;
}
// set start row index
pIter->iRow = pIter->backward? pBlockData->nRow-1:0;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册