diff --git a/src/query/inc/qResultbuf.h b/src/query/inc/qResultbuf.h index d76659cc919c89eeabb6dd8c091edd660555b285..8c8afb0957c862042e1da99e211ed06e091dee4a 100644 --- a/src/query/inc/qResultbuf.h +++ b/src/query/inc/qResultbuf.h @@ -42,6 +42,7 @@ typedef struct SDiskbasedResultBuf { void* iBuf; // inmemory buf void* handle; // for debug purpose + void* emptyDummyIdList; // dummy id list } SDiskbasedResultBuf; #define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) diff --git a/src/query/src/qResultbuf.c b/src/query/src/qResultbuf.c index 0eefb106b93149a16a3fdd1f1686533066a2793e..de59676e59679dca4feb3540e3f97981f98f10ba 100644 --- a/src/query/src/qResultbuf.c +++ b/src/query/src/qResultbuf.c @@ -36,6 +36,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t nu pResBuf->fd = FD_INITIALIZER; pResBuf->pBuf = NULL; + pResBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t)); qDebug("QInfo:%p create resBuf for output, page size:%d, initial pages:%d, %" PRId64 "bytes", handle, pResBuf->pageSize, pResBuf->numOfPages, pResBuf->totalBufSize); @@ -173,7 +174,7 @@ int32_t getNumOfRowsPerPage(SDiskbasedResultBuf* pResultBuf) { return pResultBuf SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId) { int32_t slot = getGroupIndex(pResultBuf, groupId); if (slot < 0) { - return taosArrayInit(1, sizeof(int32_t)); + return pResultBuf->emptyDummyIdList; } else { return taosArrayGetP(pResultBuf->list, slot); } @@ -206,6 +207,7 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf, void* handle) { } taosArrayDestroy(pResultBuf->list); + taosArrayDestroy(pResultBuf->emptyDummyIdList); taosHashCleanup(pResultBuf->idsTable); tfree(pResultBuf->iBuf);