Skip to main content
Estimates the approximate distinct count from a serialized HyperLogLog sketch. This function is part of the DataSketches HLL family of functions for approximate distinct counting. ds_hll_estimate takes a VARBINARY serialized sketch created by ds_hll_accumulate or ds_hll_combine and returns the estimated number of distinct values. It is based on Apache DataSketches and provides high precision for approximate distinct counting. For more information, see HyperLogLog Sketches.

Syntax

Parameters

  • sketch: A VARBINARY column containing serialized HyperLogLog sketches created by ds_hll_accumulate or ds_hll_combine.

Return Type

Returns a BIGINT representing the estimated distinct count.

Examples

  • ds_hll_accumulate: Creates serialized HyperLogLog sketches from data
  • ds_hll_combine: Combines multiple serialized sketches into a single sketch
  • ds_hll_count_distinct: Direct approximate distinct counting function

Keywords

ds_HLL_ESTIMATE, HLL, HYPERLOGLOG, APPROXIMATE, DISTINCT, COUNT, ESTIMATE