diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 8779fe54152aeb6ae26b08dccbfcf7db03b88bf2..9b15cc7adbf1d7be4a13de5e7caa19eb1538ac8c 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -621,7 +621,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) { pHandle->sortElapsed += el; // All sorted data can fit in memory, external memory sort is not needed. Return to directly - if (size <= sortBufSize) { + if (size <= sortBufSize && pHandle->pBuf == NULL) { pHandle->cmpParam.numOfSources = 1; pHandle->inMemSort = true;