fix hyperloglog bugs
This commit is contained in:
parent
c019645193
commit
ab86b6ba47
|
@ -57,7 +57,7 @@ typedef struct SFuncExecFuncs {
|
||||||
#define MAX_INTERVAL_TIME_WINDOW 10000000 // maximum allowed time windows in final results
|
#define MAX_INTERVAL_TIME_WINDOW 10000000 // maximum allowed time windows in final results
|
||||||
|
|
||||||
#define TOP_BOTTOM_QUERY_LIMIT 100
|
#define TOP_BOTTOM_QUERY_LIMIT 100
|
||||||
#define FUNCTIONS_NAME_MAX_LENGTH 16
|
#define FUNCTIONS_NAME_MAX_LENGTH 32
|
||||||
|
|
||||||
typedef struct SResultRowEntryInfo {
|
typedef struct SResultRowEntryInfo {
|
||||||
bool initialized : 1; // output buffer has been initialized
|
bool initialized : 1; // output buffer has been initialized
|
||||||
|
|
|
@ -1604,7 +1604,9 @@ static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBloc
|
||||||
bool hasCountFunc = false;
|
bool hasCountFunc = false;
|
||||||
for (int32_t i = 0; i < pOperator->exprSupp.numOfExprs; ++i) {
|
for (int32_t i = 0; i < pOperator->exprSupp.numOfExprs; ++i) {
|
||||||
if ((strcmp(pCtx[i].pExpr->pExpr->_function.functionName, "count") == 0) ||
|
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;
|
hasCountFunc = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4787,6 +4787,10 @@ int32_t hllFunction(SqlFunctionCtx* pCtx) {
|
||||||
int32_t numOfRows = pInput->numOfRows;
|
int32_t numOfRows = pInput->numOfRows;
|
||||||
|
|
||||||
int32_t numOfElems = 0;
|
int32_t numOfElems = 0;
|
||||||
|
if (IS_NULL_TYPE(type)) {
|
||||||
|
goto _hll_over;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = start; i < numOfRows + start; ++i) {
|
for (int32_t i = start; i < numOfRows + start; ++i) {
|
||||||
if (pCol->hasNull && colDataIsNull_s(pCol, i)) {
|
if (pCol->hasNull && colDataIsNull_s(pCol, i)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -4808,6 +4812,7 @@ int32_t hllFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_hll_over:
|
||||||
pInfo->totalCount += numOfElems;
|
pInfo->totalCount += numOfElems;
|
||||||
|
|
||||||
if (pInfo->totalCount == 0 && !tsCountAlwaysReturnValue) {
|
if (pInfo->totalCount == 0 && !tsCountAlwaysReturnValue) {
|
||||||
|
|
Loading…
Reference in New Issue