Skip to content

Instantly share code, notes, and snippets.

@ivanpk

ivanpk/article5.sql Secret

Created Feb 5, 2020
Embed
What would you like to do?
WITH
user_ids AS (
SELECT
'user-id-1' AS user_id
UNION ALL
SELECT
'user-id-1' AS user_id
UNION ALL
SELECT
'user-id-2' AS user_id )
SELECT
HLL_COUNT.init(user_id) as HyperLogLog_Sketch,
HLL_COUNT.extract(HLL_COUNT.init(user_id)) as Distinct_Count_from_HyperLogLog_sketch
FROM
user_ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment