Skip to content

Instantly share code, notes, and snippets.

View toru-takahashi's full-sized avatar
🏠
Working from home

Toru Takahashi toru-takahashi

🏠
Working from home
View GitHub Profile
-- Hive
SELECT user, TD_X_RANK(user) AS node_id, page_id, category, time
FROM
(
SELECT
raw_data.user, page_id, category, raw_data.time AS time
FROM
(
SELECT user, page_id, category, time
FROM raw_data_201501
-- Hive --
SELECT
user,
TD_FIRST(category, node_id) AS landing_category,
TD_LAST (category, node_id) AS last_category,
COLLECT_ALL( category ) AS category_set,
TD_FIRST(page_id, node_id) AS landing_node,
TD_LAST (page_id, node_id) AS last_node,
COLLECT_ALL( page_id ) AS node_set,