refactor(query): do some internal refactor.

This commit is contained in:
Haojun Liao 2022-09-01 15:50:41 +08:00
parent bd0523ddb9
commit 72e0f09dd2
2 changed files with 21 additions and 12 deletions

View File

@ -105,12 +105,16 @@ void tLDataIterNextBlock(SLDataIter *pIter) {
size_t size = taosArrayGetSize(pIter->aBlockL);
for(int32_t i = pIter->iBlockL; i < size && i >= 0; i += step) {
SBlockL *p = taosArrayGet(pIter->aBlockL, i);
if (p->minUid <= pIter->uid && p->maxUid >= pIter->uid) {
index = i;
if ((!pIter->backward) && p->minUid > pIter->uid) {
break;
}
if (p->minUid > pIter->uid) {
if (pIter->backward && p->maxUid < pIter->uid) {
break;
}
if (p->minUid <= pIter->uid && p->maxUid >= pIter->uid) {
index = i;
break;
}
}
@ -145,8 +149,18 @@ static void findNextValidRow(SLDataIter* pIter) {
}
int64_t ts = pIter->bData.aTSKEY[i];
if (ts < pIter->timeWindow.skey) {
continue;
if (!pIter->backward) { // asc
if (ts > pIter->timeWindow.ekey) { // no more data
break;
} else if (ts < pIter->timeWindow.skey) {
continue;
}
} else {
if (ts < pIter->timeWindow.skey) {
break;
} else if (ts > pIter->timeWindow.ekey) {
continue;
}
}
int64_t ver = pIter->bData.aVersion[i];
@ -154,11 +168,6 @@ static void findNextValidRow(SLDataIter* pIter) {
continue;
}
// no data any more, todo opt handle desc case
if (ts > pIter->timeWindow.ekey) {
continue;
}
// todo opt handle desc case
if (ver > pIter->verRange.maxVer) {
continue;
@ -235,8 +244,7 @@ _exit:
}
SRowInfo *tLDataIterGet(SLDataIter *pIter) {
// TODO
return NULL;
return &pIter->rInfo;
}
// SMergeTree =================================================

View File

@ -636,6 +636,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SArray*
{
// 1. time range check
printf("%ld, %ld\n", pLastBlock->minKey, pLastBlock->maxKey);
if (pLastBlock->minKey > pReader->window.ekey || pLastBlock->maxKey < pReader->window.skey) {
continue;
}