From ea05f8af12142b547b9afe4b45e52593aadc5869 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 8 Jun 2022 20:30:43 +0800 Subject: [PATCH] fix bugs --- source/libs/function/src/builtins.c | 2 +- source/libs/function/src/builtinsimpl.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index f6414a6e20..e900d2d49a 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1463,7 +1463,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .classification = FUNC_MGT_AGG_FUNC, .translateFunc = translateHistogramMerge, .getEnvFunc = getHistogramFuncEnv, - .initFunc = histogramFunctionSetup, + .initFunc = functionSetup, .processFunc = histogramFunctionMerge, .finalizeFunc = histogramFinalize }, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 41414efba5..c279ceb01e 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -3345,11 +3345,12 @@ int32_t histogramFunctionMerge(SqlFunctionCtx *pCtx) { pInfo->numOfBins = pInputInfo->numOfBins; pInfo->totalCount += pInputInfo->totalCount; for (int32_t k = 0; k < pInfo->numOfBins; ++k) { + pInfo->bins[k].lower = pInputInfo->bins[k].lower; + pInfo->bins[k].upper = pInputInfo->bins[k].upper; pInfo->bins[k].count += pInputInfo->bins[k].count; } - SET_VAL(GET_RES_INFO(pCtx), 1, 1); - + SET_VAL(GET_RES_INFO(pCtx), pInfo->numOfBins, pInfo->numOfBins); return TSDB_CODE_SUCCESS; } @@ -3404,7 +3405,7 @@ int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { colDataAppend(pCol, pBlock->info.rows, res, false); taosMemoryFree(res); - return pResInfo->numOfRes; + return 1; } bool getHLLFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { -- GitLab