Relational Data - Aggregate Functions - Reference - Uniqthetasketch

From FojiSoft Docs
Revision as of 18:44, 28 August 2024 by Chris.Hansen (talk | contribs) (Import ClickHouse Docs: Wed Aug 28 2024 14:44:11 GMT-0400 (Eastern Daylight Time))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Calculates the approximate number of different argument values, using the Theta Sketch Framework.

uniqTheta(x[, ...])

Arguments

The function takes a variable number of parameters. Parameters can be Tuple, Array, Date, DateTime, String, or numeric types.

Returned value

Implementation details

Function:

  • Calculates a hash for all parameters in the aggregate, then uses it in calculations.

  • Uses the KMV algorithm to approximate the number of different argument values.

      4096(2^12) 64-bit sketch are used. The size of the state is about 41 KB.
  • The relative error is 3.125% (95% confidence), see the relative error table for detail.

See Also