Categories:

Aggregate functions (Cardinality Estimation) , Window functions (Cardinality Estimation)

HLL_EXPORT

Converts input in BINARY format to OBJECT format.

The HyperLogLog states operated on by HLL_ACCUMULATE, HLL_COMBINE, and HLL_ESTIMATE are in a proprietary binary format that may change in future versions of Snowflake. For long-term storage of HyperLogLog states, and for integration with external tools, Snowflake supports converting states from the BINARY format to an OBJECT (which can be printed and exported as JSON), and vice versa.

See also:

HLL , HLL_ACCUMULATE , HLL_ESTIMATE , HLL_IMPORT

Syntax

Aggregate function

HLL_EXPORT( <binary_expr> )
Copy

Window function

HLL_EXPORT( <binary_expr> ) OVER ( [ PARTITION BY <expr> ] )
Copy

For details about the OVER clause, see Window function syntax and usage.

Arguments

binary_expr

An expression that evaluates to a HyperLogLog state in BINARY format.

Usage notes

Examples

SELECT HLL(o_orderdate), HLL_ESTIMATE(HLL_IMPORT(HLL_EXPORT(HLL_ACCUMULATE(o_orderdate))))
FROM orders;

------------------+-------------------------------------------------------------------+
 HLL(O_ORDERDATE) | HLL_ESTIMATE(HLL_IMPORT(HLL_EXPORT(HLL_ACCUMULATE(O_ORDERDATE)))) |
------------------+-------------------------------------------------------------------+
 2398             | 2398                                                              |
------------------+-------------------------------------------------------------------+
Copy