SELECT
some_name,
map_keys(
histogram(some_type)
)
FROM foo
GROUP BY some_name
SELECT TD_SESSIONIZE(time, 3600, ip_address) as session_id
FROM ...
ORDER BY ip_address, time
-- ↑ソートしないと正しく出ない!
SELECT
*
TD_PARSE_AGENT(user_agent)['ua_family'] AS family,
TD_PARSE_AGENT(user_agent)['ua_major'] AS version
FROM
access
WHERE TD_PARSE_AGENT(user_agent) IN ['pc', 'smartphone']
WITH a AS (
SELECT
TD_PARSE_AGENT(user_agent)['ua_family'] AS family,
TD_PARSE_AGENT(user_agent)['ua_major'] AS version
FROM
access
),
b AS (
SELECT
if(family = 'IE', family || version, family) AS browser
FROM a
)
SELECT * FROM b
SELECT
TD_PARSE_AGENT(user_agent)['os_family']
TD_PARSE_AGENT(user_agent)['os_major']
TD_PARSE_AGENT(user_agent)['os_minor']
TD_PARSE_AGENT(user_agent)['ua_family']
TD_PARSE_AGENT(user_agent)['ua_major']
TD_PARSE_AGENT(user_agent)['ua_minor']
TD_PARSE_AGENT(user_agent)['device']
FROM access
SELECT *
FROM access
WHERE
url_extract_host(referer) = "google.com"
-- 正規表現でやるとこんな感じ
-- regexp_like(referer, '.*google.com/.*')