From 9fa47f7e676ed1662310949e9a437a7d0896745d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 20 Jul 2022 13:22:49 +0800 Subject: [PATCH] fix(query): twa function handling null constant or all null column TD-17562 --- source/libs/function/src/builtinsimpl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index dfc5b6a363..7a76e1136e 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -5210,6 +5210,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { SPoint1* last = &pInfo->p; int32_t numOfElems = 0; + if (IS_NULL_TYPE(pInputCol->info.type)) { + pInfo->isNull = true; + goto _twa_over; + } + int32_t i = pInput->startRowIndex; if (pCtx->start.key != INT64_MIN) { ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || @@ -5393,10 +5398,6 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { } break; } - case TSDB_DATA_TYPE_NULL: { - pInfo->isNull = true; - break; - } default: ASSERT(0); @@ -5410,6 +5411,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { pInfo->win.ekey = pInfo->p.key; +_twa_over: if (numOfElems == 0) { pInfo->isNull = true; } -- GitLab