citusdata / citusdata/postgresql-hll

effective MAX regwidth is inconsistent with storage spec and java-hll

Open
#30 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.2k
Forks
115
PR merge metrics
No merged PRs in 30d

Description

The storage spec & postgresql-hll docs say...

https://github.com/aggregateknowledge/hll-storage-spec/blob/v1.0.0/STORAGE.md

> registerWidth may take values from 1 to 8, inclusive, ...
> https://github.com/aggregateknowledge/postgresql-hll/blob/master/README.markdown#explanation-of-parameters-and-tuning
> The number of bits used per register in the HyperLogLog algorithm. Must be at least 1 and at most 8

My C is a bit rusty, so i may be missing something, but based on skimming the code, the effective MAX regwidth thta can be used in postgresql-hll is actually 7 -- and that seems to be supported by the error message string in the code...

```
#define REGWIDTH_BITS 3
...
#define MAX_BITVAL(nbits) ((1 << nbits) - 1)
...
if (regwidth < 0 || regwidth > MAX_BITVAL(REGWIDTH_BITS))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("regwidth modifier must be between 0 and 7")));
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.