本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
HLL_COMBINE_SKETCHES 函數
HLL_COMBINE_SKETCHES 是一種純量函數,作為輸入兩個HLLSKETCH值,並將其合併為單一 HLLSKETCH。
兩個或多個 HyperLogLog 草圖的組合是新的HLLSKETCH,其封裝了每個輸入草圖所代表不同值的結合相關資訊。
語法
HLL_COMBINE_SKETCHES (hllsketch_expression1, hllsketch_expression2)
引數
- hllsketch_expression1 和 hllsketch_expression2
-
任何評估為 HLLSKETCH類型的有效表達式,例如資料欄名稱。
傳回類型
HLL_COMBINE_SKETCHES 函數傳回HLLSKETCH類型。
範例
下列範例會傳回資料表 中的組合HLLSKETCH值hll_table
。
WITH tbl1(x, y) AS (SELECT Hll_create_sketch(1), Hll_create_sketch(2) UNION ALL SELECT Hll_create_sketch(3), Hll_create_sketch(4) UNION ALL SELECT Hll_create_sketch(5), Hll_create_sketch(6) UNION ALL SELECT Hll_create_sketch(7), Hll_create_sketch(8)), tbl2(x, y) AS (SELECT Hll_create_sketch(9), Hll_create_sketch(10) UNION ALL SELECT Hll_create_sketch(11), Hll_create_sketch(12) UNION ALL SELECT Hll_create_sketch(13), Hll_create_sketch(14) UNION ALL SELECT Hll_create_sketch(15), Hll_create_sketch(16) UNION ALL SELECT Hll_create_sketch(NULL), Hll_create_sketch(NULL)), tbl3(x, y) AS (SELECT * FROM tbl1 UNION ALL SELECT * FROM tbl2) SELECT Hll_combine_sketches(x, y) FROM tbl3;