Skip to main content
Returns the approximate value of aggregate function similar to the result of COUNT(DISTINCT col). APPROX_COUNT_DISTINCT(expr) is similar function. ds_hll_count_distinct is faster than the COUNT and DISTINCT combination and uses a fixed-size memory, so less memory is required for columns of high cardinality. It is slower than APPROX_COUNT_DISTINCT(expr) but with higher precision because it adopts of Apache Datasketches. For more information, see HyperLogLog Sketches.

Syntax

  • log_k: Integer. Range [4, 21]. Default: 17.
  • tgt_type: Valid values are HLL_4, HLL_6 (default) and HLL_8.

Examples

text

Keywords

DS_HLL_COUNT_DISTINCT,APPROX_COUNT_DISTINCT