HLL_ACCUMULATE

functionsupportedCore SQL functions

docs.snowflake.com ↗

Aggregate functionsWindow functions

Returns 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

NameRequiredDescription
exprrequiredThe 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

See also

Referenced by