diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index be4d849fb99e1f030f48f08e43e7407cd3676451..b64ce5296654b348c25029b6cca1cecc7feccaf0 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -758,7 +758,12 @@ static void doUpdateResultRowIndex(SResultRowInfo*pResultRowInfo, TSKEY lastKey, } } - pResultRowInfo->curIndex = i + 1; // current not closed result object + if (i == pResultRowInfo->size - 1) { + pResultRowInfo->curIndex = i; + } else { + pResultRowInfo->curIndex = i + 1; // current not closed result object + } + pResultRowInfo->prevSKey = pResultRowInfo->pResult[pResultRowInfo->curIndex]->win.skey; } } @@ -7715,4 +7720,4 @@ void** qReleaseQInfo(void* pMgmt, void* pQInfo, bool freeHandle) { taosCacheRelease(pQueryMgmt->qinfoPool, pQInfo, freeHandle); return 0; -} \ No newline at end of file +}