approx_count_distinct
The number of distinct non-null values from a HyperLogLog sketch (options lg_k 4 to 21, default 12; seed, default 0; confidence 1, 2 or 3 standard deviations, default 2): {estimate, lower, upper} as Float64, error kind relative_value.
Flags
| Flag | Value |
|---|---|
| Kind | aggregate |
| Nulls | never null |
| Deterministic | yes |
| Order matters | no |
| Decomposable | yes, by an HLL sketch |
Example
A pipeline from the language's tested corpus that uses approx_count_distinct, over the example tables.
from orders
aggregate {d = approx_count_distinct(customer, lg_k: 10), m = approx_quantile(amount, q: 5e-1, seed: 7, confidence: 3), top = approx_frequent(status, max_map_size: 16, rule: "no_false_negatives")} by:{rush}In a plan:
{
"args": [
{
"col": 1
}
],
"fn": "approx_count_distinct",
"options": {
"lg_k": 10
}
}