A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/hll below:

Website Navigation


HLL | Snowflake Documentation

Categories:

Aggregate functions (Cardinality Estimation) , Window functions

HLL

Uses HyperLogLog to return an approximation of the distinct cardinality of the input (i.e. HLL(col1, col2, ... ) returns an approximation of COUNT(DISTINCT col1, col2, ... )).

For more information about HyperLogLog, see Estimating the Number of Distinct Values.

Aliases:

APPROX_COUNT_DISTINCT.

See also:

HLL_ACCUMULATE , HLL_COMBINE , HLL_ESTIMATE

Syntax

Aggregate function

HLL( [ DISTINCT ] <expr1> [ , ... ] )

HLL(*)

Copy

Window function

HLL( [ DISTINCT ] <expr1> [ , ... ] ) OVER ( [ PARTITION BY <expr2> ] )

HLL(*) OVER ( [ PARTITION BY <expr2> ] )

Copy

Arguments
expr1

This is the expression for which you want to know the number of distinct values.

expr2

This is the optional expression used to group rows into partitions.

Returns

The data type of the returned value is INTEGER.

Usage notes Examples

This example shows how to use HLL and its alias APPROX_COUNT_DISTINCT. This example calls both COUNT(DISTINCT i) and APPROX_COUNT_DISTINCT(i) to emphasize that the results of these two functions do not always match exactly.

The exact output from the following query might vary because APPROX_COUNT_DISTINCT() returns an approximation, not an exact value.

SELECT COUNT(i), COUNT(DISTINCT i), APPROX_COUNT_DISTINCT(i), HLL(i)
  FROM sequence_demo;

Copy


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4