- Categories:
Aggregate functions (Cardinality Estimation) , Window functions (Cardinality Estimation)
HLL_ ESTIMATE¶
返回给定 HyperLogLog 状态的基数估计值。
A HyperLogLog state produced by HLL_ACCUMULATE and HLL_COMBINE can be used to compute a cardinality estimate using the HLL_ESTIMATE function.
因此,HLL_ESTIMATE(HLL_ACCUMULATE(…)) 等效于 HLL(…)。
- See also:
语法
聚合函数
窗口函数
For details about the OVER clause, see Window function syntax and usage.
实参
stateAn expression that contains state information generated by a call to HLL_ACCUMULATE or HLL_COMBINE.
使用说明
- This function can be used as an aggregate function or a window function.
示例
This example shows how to use the three related functions HLL_ACCUMULATE, HLL_ESTIMATE, and HLL_COMBINE.
创建简单的表和数据:
Create a table that contains the “state” that represents the current
approximate cardinality information for the table named sequence_demo:
Now create a second table and add data. (In a more realistic situation, the user could have loaded more data into the first table and divided the data into non-overlapping sets based on the time that the data was loaded.)
仅获取新数据的“状态”信息。
合并两批行的“状态”信息:
获取行组合集的近似基数: