The HLL_RAW_AGG function is an aggregate function mainly used to merge multiple HyperLogLog data structures into one.
HLL_RAW_AGG(<hll>) HLL_UNION(<hll>)
| Parameter | Description |
|---|---|
<hll> | The expression to be calculated, type HLL supported. |
Returns the aggregated HLL type. If there is no valid data in the group, returns HLL_EMPTY.
-- setup create table test_uv( id int, uv_set string ) distributed by hash(id) buckets 1 properties ("replication_num"="1"); insert into test_uv values (1, ('a')), (1, ('b')), (2, ('c')), (2, ('d')), (3, null);
select HLL_CARDINALITY(HLL_RAW_AGG(hll_hash(uv_set))) from test_uv;
+------------------------------------------------+ | HLL_CARDINALITY(HLL_RAW_AGG(hll_hash(uv_set))) | +------------------------------------------------+ | 4 | +------------------------------------------------+
select HLL_CARDINALITY(HLL_RAW_AGG(hll_hash(uv_set))) from test_uv where uv_set is null;
+------------------------------------------------+ | HLL_CARDINALITY(HLL_RAW_AGG(hll_hash(uv_set))) | +------------------------------------------------+ | 0 | +------------------------------------------------+