approx_frequent
The heaviest values from a Misra–Gries sketch (option max_map_size, a power of 2, default 64; rule no_false_positives, the default, or no_false_negatives): a list of {item, estimate, lower, upper}, heaviest first, error kind absolute_weight.
Flags
| Flag | Value |
|---|---|
| Kind | aggregate |
| Nulls | never null |
| Deterministic | yes |
| Order matters | no |
| Decomposable | yes, by a frequent-items sketch |
Example
A pipeline from the language's tested corpus that uses approx_frequent, 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": 7
}
],
"fn": "approx_frequent",
"options": {
"max_map_size": 16,
"rule": "no_false_negatives"
}
}