Skip to content

Commit 72dfcc3

Browse files
poyrazKgithub-actions[bot]
authored andcommitted
style: automated clang-format fixes
1 parent 8cca192 commit 72dfcc3

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

include/common/hll.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ namespace common {
3131
*/
3232
class HyperLogLog {
3333
public:
34-
static constexpr size_t kNumRegisters = 2048; // 2^11 for 11-bit index
35-
static constexpr double kPowBase = 2.0; // base for 2^(-reg) computation
36-
static constexpr int kIndexBits = 11; // bits used for register index
34+
static constexpr size_t kNumRegisters = 2048; // 2^11 for 11-bit index
35+
static constexpr double kPowBase = 2.0; // base for 2^(-reg) computation
36+
static constexpr int kIndexBits = 11; // bits used for register index
3737

3838
// Linear counting fallback: when nonzero registers < m / kLinearCountingThreshold,
3939
// raw HLL formula overestimates severely (e.g., 3 distinct values → 23k estimate).
@@ -93,8 +93,8 @@ class HyperLogLog {
9393
int empty_count = static_cast<int>(m) - nonzero_count;
9494

9595
// For sparse data (few registers used), use linear counting to avoid
96-
// HLL's extreme overestimation. When registers are sparse (nonzero < m/kLinearCountingThreshold),
97-
// the HLL raw formula gives wildly incorrect results.
96+
// HLL's extreme overestimation. When registers are sparse (nonzero <
97+
// m/kLinearCountingThreshold), the HLL raw formula gives wildly incorrect results.
9898
if (nonzero_count < static_cast<int>(m / kLinearCountingThreshold)) {
9999
// Linear counting: E[n] ≈ -m * log(V/m) where V = empty fraction
100100
double linear_est = -m * std::log2(static_cast<double>(empty_count) / m);

tests/hll_test.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ TEST(HyperLogLogTests, MergeCombinesDistinctSets) {
140140
*/
141141
TEST(HyperLogLogTests, TextValueInsertion) {
142142
HyperLogLog hll;
143-
std::vector<std::string> texts = {
144-
"alpha", "beta", "gamma", "delta", "epsilon",
145-
"zeta", "eta", "theta", "iota", "kappa"};
143+
std::vector<std::string> texts = {"alpha", "beta", "gamma", "delta", "epsilon",
144+
"zeta", "eta", "theta", "iota", "kappa"};
146145
for (const auto& t : texts) {
147146
uint64_t hash = HyperLogLog::hash_bytes(t.data(), t.size());
148147
hll.insert(hash);
@@ -270,7 +269,7 @@ TEST(HyperLogLogTests, ValueTypeColumnCoverage) {
270269

271270
// TEXT values via hash_bytes (mimics execute_analyze path)
272271
std::vector<std::string> texts = {"alpha", "beta", "gamma", "delta", "epsilon",
273-
"zeta", "eta", "theta", "iota", "kappa"};
272+
"zeta", "eta", "theta", "iota", "kappa"};
274273
for (const auto& t : texts) {
275274
uint64_t hash = HyperLogLog::hash_bytes(t.data(), t.size());
276275
hll_text.insert(hash);

0 commit comments

Comments
 (0)