From 9ab98f0230ff176950408ae733781d64dd5dcdb0 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 22 Dec 2022 20:56:23 +0800 Subject: [PATCH] fix: fill value issue --- source/libs/executor/src/tfill.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 78ecb02b93..9735ce40c9 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -293,12 +293,14 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t int64_t ts = ((int64_t*)pTsCol->pData)[pFillInfo->index]; // set the next value for interpolation - if (pFillInfo->currentKey < ts && ascFill) { - copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, &pFillInfo->prev); - } else if (pFillInfo->currentKey > ts && !ascFill) { + if ((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) { copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, &pFillInfo->next); } + if (pFillInfo->currentKey < ts && ascFill && 0 == pFillInfo->index) { + copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, &pFillInfo->prev); + } + if (((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) && pFillInfo->numOfCurrent < outputRows) { // fill the gap between two input rows