Skip to main content
Extracts a cardinality estimate of a single HLL++ sketch that was previously built using the aggregate function HLL_COUNT_BUILD.

Syntax

Parameters

Return Type

BIGINT

Examples

The following example builds an HLL++ sketch from 1,000 unique integers using HLL_COUNT_BUILD and estimates the distinct count:

Rows: 1Execution time: 6.16ms

HLL_COUNT_ESTIMATE can also be applied to each sketch independently before merging. The following example builds two sketches from overlapping ranges and estimates the cardinality of each:

Rows: 2Execution time: 6.18ms

To estimate the combined count across all sketches, use HLL_COUNT_MERGE to merge them first. The two ranges 1–500 and 251–750 share 250 values, giving 750 unique values in total:

Rows: 1Execution time: 6.21ms