From 2dbd4b0ee1882ae04dcd598a40eeca8ef52f4564 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 4 Jan 2022 11:48:19 +0800 Subject: [PATCH] [TS-927](query): fix fill(linear) with null values --- src/query/src/qFill.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/query/src/qFill.c b/src/query/src/qFill.c index b0015e39b9..9694dac7db 100644 --- a/src/query/src/qFill.c +++ b/src/query/src/qFill.c @@ -101,7 +101,6 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index); } } else if (pFillInfo->type == TSDB_FILL_LINEAR) { - // TODO : linear interpolation supports NULL value if (prev != NULL && !outOfBound) { for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; @@ -121,6 +120,10 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData bool exceedMax = false, exceedMin = false; point1 = (SPoint){.key = *(TSKEY*)(prev), .val = prev + pCol->col.offset}; point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->index * bytes}; + if (isNull(point1.val, type) || isNull(point2.val, type)) { + setNull(val1, pCol->col.type, bytes); + continue; + } point = (SPoint){.key = pFillInfo->currentKey, .val = val1}; taosGetLinearInterpolationVal(&point, type, &point1, &point2, type, &exceedMax, &exceedMin); } -- GitLab