Encapsulate HLL logic (#1756)

This commit is contained in:
kangkaisen
2019-09-09 15:52:10 +08:00
committed by ZHAO Chun
parent a349409838
commit cd5cfea5cc
19 changed files with 706 additions and 372 deletions

View File

@ -672,14 +672,14 @@ void CsvScanNode::hll_hash(const char* src, int len, std::string* result) {
std::string str(src, len);
if (str != "\\N") {
uint64_t hash = HashUtil::murmur_hash64A(src, len, HashUtil::MURMUR_SEED);
char buf[HllHashFunctions::HLL_INIT_EXPLICT_SET_SIZE];
char buf[10];
// expliclit set
buf[0] = HLL_DATA_EXPLICIT;
buf[1] = 1;
*((uint64_t*)(buf + 2)) = hash;
*result = std::string(buf, sizeof(buf));
} else {
char buf[HllHashFunctions::HLL_EMPTY_SET_SIZE];
char buf[1];
// empty set
buf[0] = HLL_DATA_EMPTY;
*result = std::string(buf, sizeof(buf));