fix: fix order by ts desc error

This commit is contained in:
Ganlin Zhao 2023-06-13 17:28:31 +08:00
parent 500493b157
commit 647ddaad97
1 changed files with 3 additions and 3 deletions

View File

@ -2852,12 +2852,12 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
goto _end;
}
TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader);
TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader);
// it is a clean block, load it directly
if (isCleanFileDataBlock(pReader, pBlockInfo, pBlock, pBlockScanInfo, keyInBuf, pLastBlockReader) &&
pBlock->nRow <= pReader->resBlockInfo.capacity) {
if (asc || (!hasDataInLastBlock(pLastBlockReader))) {
if (asc || (!hasDataInLastBlock(pLastBlockReader) && (!asc && (pBlock->maxKey.ts > keyInBuf.ts)))) {
code = copyBlockDataToSDataBlock(pReader);
if (code) {
goto _end;