HLL_ACCUMULATE
functionsupportedCore SQL functionsReturns the HyperLogLog state at the end of aggregation. For more information about HyperLogLog, see Estimating the Number of Distinct Values. HLL discards its intermediate state when the final cardinality estimate is returned. In advanced use cases, such as incremental cardinality estimation during bulk loading, one may want to keep the intermediate state. The intermediate state can later be combined (merged) with other intermediate states, or can be exported to external tools. In contrast to HLL, HLL_ACCUMULATE does not return a cardinality estimate. Instead, it skips the final estimation step and returns the algorithm state itself. The state is a binary of at most 4096 Bytes. For more information, see Estimating the Number of Distinct Values.
Syntax
supportedpartialnot supportednot scored
Aggregate function
HLL_ACCUMULATE( [ DISTINCT ] <expr> )
HLL_ACCUMULATE(*)
Window function
HLL_ACCUMULATE( [ DISTINCT ] <expr> ) OVER ( [ PARTITION BY <expr1> ] )
HLL_ACCUMULATE(*) OVER ( [ PARTITION BY <expr1> ] )
Parameters
| Name | Required | Description |
|---|---|---|
expr | required | The expression for which you want to estimate cardinality (number of distinct values). This is typically a column name, but can be a more general expression. |
Usage notes
- This function can be used as an aggregate function or a window function.
- DISTINCT is supported syntactically, but has no effect.