diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index ec451274ab..2ec8ef202c 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -71,7 +71,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo int32_t size = taosArrayGetSize(pWinStates); int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); - if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0) { + if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0 || size == 0) { // find the first position which is smaller than the pKey if (index >= 0) { SWinKey* pTmpKey = taosArrayGet(pWinStates, index);