DATASKETCHES_HLL_COMBINE

functionsupportedCore SQL functions

docs.snowflake.com ↗

Aggregate functionsWindow function syntax and usage

Combines (merges) input sketches into a single output sketch. This function is a version of the HLL HyperLogLog function that can read binary sketches in the format used by Apache DataSketches. For more information, see the Apache DataSketches documentation. This function allows scenarios where the DATASKETCHES_HLL_ACCUMULATE function is run over horizontal partitions of the same table, producing an algorithm sketch for each table partition. These sketches can later be combined using this function, producing the same output sketch as a single run of DATASKETCHES_HLL_ACCUMULATE over the entire table.

Syntax

supportedpartialnot supportednot scored

DATASKETCHES_HLL_COMBINE( [ DISTINCT ]  <state> [ , <max_log_k> ] )

Parameters

NameRequiredDescription
staterequiredAn expression that contains state information generated by a call to DATASKETCHES_HLL_ACCUMULATE.
max_log_koptionalThe maximum value, in log2, of K for this union. Specify an INTEGER value between 4 and 21, inclusive. For more information, see the Apache DataSketches documentation. Default: 12

Returns

The function returns a BINARY value that is compatible with the Apache Datasketches library.

Usage notes

See also

Referenced by