From 5fffeba2f3759f74c78fe79ede05048d4f585d7c Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 3 Nov 2022 10:39:53 +0800 Subject: [PATCH] fix(query): fix countAlwaysReturnValue param not taking effect for count and hyperloglog function TD-20140 --- source/libs/function/src/builtinsimpl.c | 2 +- source/libs/function/src/functionMgt.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index c8f0b3d826..9ae169bcf4 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -551,7 +551,7 @@ int32_t countFunction(SqlFunctionCtx* pCtx) { if (tsCountAlwaysReturnValue) { pResInfo->numOfRes = 1; } else { - SET_VAL(pResInfo, 1, 1); + SET_VAL(pResInfo, *((int64_t*)buf), 1); } return TSDB_CODE_SUCCESS; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 0de914271c..6ab91a4483 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -241,7 +241,11 @@ bool fmIsNotNullOutputFunc(int32_t funcId) { FUNCTION_TYPE_LAST_MERGE == funcMgtBuiltins[funcId].type || FUNCTION_TYPE_FIRST == funcMgtBuiltins[funcId].type || FUNCTION_TYPE_FIRST_PARTIAL == funcMgtBuiltins[funcId].type || - FUNCTION_TYPE_FIRST_MERGE == funcMgtBuiltins[funcId].type; + FUNCTION_TYPE_FIRST_MERGE == funcMgtBuiltins[funcId].type || + FUNCTION_TYPE_COUNT == funcMgtBuiltins[funcId].type || + FUNCTION_TYPE_HYPERLOGLOG == funcMgtBuiltins[funcId].type || + FUNCTION_TYPE_HYPERLOGLOG_PARTIAL == funcMgtBuiltins[funcId].type || + FUNCTION_TYPE_HYPERLOGLOG_MERGE == funcMgtBuiltins[funcId].type; } bool fmIsSelectValueFunc(int32_t funcId) { -- GitLab