From ca2ad71bb892fd5544373f96ade9ab0b607c958f Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 25 Jul 2023 13:08:37 +0800 Subject: [PATCH] fix: return null when there are no input stream blocks for priority queue sort --- source/libs/executor/src/tsort.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 738f3f7131..7784bc0c94 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -1405,6 +1405,9 @@ static int32_t tsortOpenForPQSort(SSortHandle* pHandle) { } static STupleHandle* tsortPQSortNextTuple(SSortHandle* pHandle) { + if (pHandle->pDataBlock == NULL) { // when no input stream datablock + return NULL; + } blockDataCleanup(pHandle->pDataBlock); blockDataEnsureCapacity(pHandle->pDataBlock, 1); // abandon the top tuple if queue size bigger than max size -- GitLab