提交 ab86b6ba 编写于 作者: G Ganlin Zhao

fix hyperloglog bugs

上级 c0196451
......@@ -57,7 +57,7 @@ typedef struct SFuncExecFuncs {
#define MAX_INTERVAL_TIME_WINDOW 10000000 // maximum allowed time windows in final results
#define TOP_BOTTOM_QUERY_LIMIT 100
#define FUNCTIONS_NAME_MAX_LENGTH 16
#define FUNCTIONS_NAME_MAX_LENGTH 32
typedef struct SResultRowEntryInfo {
bool initialized : 1; // output buffer has been initialized
......
......@@ -1604,7 +1604,9 @@ static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBloc
bool hasCountFunc = false;
for (int32_t i = 0; i < pOperator->exprSupp.numOfExprs; ++i) {
if ((strcmp(pCtx[i].pExpr->pExpr->_function.functionName, "count") == 0) ||
(strcmp(pCtx[i].pExpr->pExpr->_function.functionName, "hyperloglog") == 0)) {
(strcmp(pCtx[i].pExpr->pExpr->_function.functionName, "hyperloglog") == 0) ||
(strcmp(pCtx[i].pExpr->pExpr->_function.functionName, "_hyperloglog_partial") == 0) ||
(strcmp(pCtx[i].pExpr->pExpr->_function.functionName, "_hyperloglog_merge") == 0)) {
hasCountFunc = true;
break;
}
......
......@@ -4787,6 +4787,10 @@ int32_t hllFunction(SqlFunctionCtx* pCtx) {
int32_t numOfRows = pInput->numOfRows;
int32_t numOfElems = 0;
if (IS_NULL_TYPE(type)) {
goto _hll_over;
}
for (int32_t i = start; i < numOfRows + start; ++i) {
if (pCol->hasNull && colDataIsNull_s(pCol, i)) {
continue;
......@@ -4808,6 +4812,7 @@ int32_t hllFunction(SqlFunctionCtx* pCtx) {
}
}
_hll_over:
pInfo->totalCount += numOfElems;
if (pInfo->totalCount == 0 && !tsCountAlwaysReturnValue) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册