提交 0b3a3aff 编写于 作者: G Ganlin Zhao

fix hll tsCountAlwaysReturnValue not working

上级 49715a28
......@@ -181,6 +181,7 @@ typedef enum { UNKNOWN_BIN = 0, USER_INPUT_BIN, LINEAR_BIN, LOG_BIN } EHistoBinT
typedef struct SHLLFuncInfo {
uint64_t result;
uint64_t totalCount;
uint8_t buckets[HLL_BUCKETS];
} SHLLInfo;
......@@ -4605,7 +4606,14 @@ int32_t hllFunction(SqlFunctionCtx* pCtx) {
}
}
SET_VAL(GET_RES_INFO(pCtx), numOfElems, 1);
pInfo->totalCount += numOfElems;
if (pInfo->totalCount == 0 && !tsCountAlwaysReturnValue) {
SET_VAL(GET_RES_INFO(pCtx), 0, 1);
} else {
SET_VAL(GET_RES_INFO(pCtx), 1, 1);
}
return TSDB_CODE_SUCCESS;
}
......@@ -4615,6 +4623,7 @@ static void hllTransferInfo(SHLLInfo* pInput, SHLLInfo* pOutput) {
pOutput->buckets[k] = pInput->buckets[k];
}
}
pOutput->totalCount += pInput->totalCount;
}
int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) {
......@@ -4632,7 +4641,12 @@ int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) {
hllTransferInfo(pInputInfo, pInfo);
}
SET_VAL(GET_RES_INFO(pCtx), 1, 1);
if (pInfo->totalCount == 0 && !tsCountAlwaysReturnValue) {
SET_VAL(GET_RES_INFO(pCtx), 0, 1);
} else {
SET_VAL(GET_RES_INFO(pCtx), 1, 1);
}
return TSDB_CODE_SUCCESS;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册