approx_count()
Estimate the number of times a value appears from a `CountMinSketch`
Early access 1.8.0
Estimate the number of times a given text value appears in a column.
Samples
Section titled “Samples”Given a table of stock data, estimate how many times the symbol AAPL appears:
WITH t AS ( SELECT toolkit_experimental.count_min_sketch(symbol, 0.01, 0.01) AS symbol_sketch FROM crypto_ticks)SELECT toolkit_experimental.approx_count('AAPL', symbol_sketch)FROM t;Arguments
Section titled “Arguments”The syntax is:
approx_count ( item TEXT, agg CountMinSketch) RETURNS BIGINT| Name | Type | Default | Required | Description |
|---|---|---|---|---|
item | TEXT | - | ✔ | The value you want to estimate occurrences of |
agg | CountMinSketch | - | ✔ | A CountMinSketch object created using count_min_sketch |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| approx_count | BIGINT | The estimated number of times item appeared in the sketch |