Last active
September 28, 2016 03:44
-
-
Save taka-treasuredata/f924347516c1f9c2a5d42c3ac0a574b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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, | |
MAX(node_id) AS path_length, | |
MIN(time) AS landing_time, | |
MAX(time) AS last_time | |
FROM ( | |
SELECT user, node_id, page_id, category, time FROM itmd_unconversion_path ORDER BY user, node_id | |
) itmd_unconversion_path | |
GROUP BY user | |
ORDER BY user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment