fix hll tsCountAlwaysReturnValue not working
This commit is contained in:
parent
49715a2898
commit
0b3a3aff21
|
@ -181,6 +181,7 @@ typedef enum { UNKNOWN_BIN = 0, USER_INPUT_BIN, LINEAR_BIN, LOG_BIN } EHistoBinT
|
||||||
|
|
||||||
typedef struct SHLLFuncInfo {
|
typedef struct SHLLFuncInfo {
|
||||||
uint64_t result;
|
uint64_t result;
|
||||||
|
uint64_t totalCount;
|
||||||
uint8_t buckets[HLL_BUCKETS];
|
uint8_t buckets[HLL_BUCKETS];
|
||||||
} SHLLInfo;
|
} 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;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4615,6 +4623,7 @@ static void hllTransferInfo(SHLLInfo* pInput, SHLLInfo* pOutput) {
|
||||||
pOutput->buckets[k] = pInput->buckets[k];
|
pOutput->buckets[k] = pInput->buckets[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pOutput->totalCount += pInput->totalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) {
|
int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) {
|
||||||
|
@ -4632,7 +4641,12 @@ int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) {
|
||||||
hllTransferInfo(pInputInfo, pInfo);
|
hllTransferInfo(pInputInfo, pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pInfo->totalCount == 0 && !tsCountAlwaysReturnValue) {
|
||||||
|
SET_VAL(GET_RES_INFO(pCtx), 0, 1);
|
||||||
|
} else {
|
||||||
SET_VAL(GET_RES_INFO(pCtx), 1, 1);
|
SET_VAL(GET_RES_INFO(pCtx), 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue