Last active
December 21, 2015 23:58
-
-
Save frsyuki/6385494 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
-- landing page access ranking analysis using Treasure Data | |
SELECT first_path, COUNT(1) AS count | |
FROM ( | |
SELECT TD_SESSIONIZE(time, 3600, host) AS session_id, TD_FIRST(path, time) AS first_path | |
FROM ( | |
SELECT time, v['host'] as host, v['path'] as path | |
FROM www_access | |
DISTRIBUTE BY v['host'] | |
SORT BY v['host'], v['time'] | |
) ss | |
GROUP BY TD_SESSIONIZE(time, 3600, host) | |
HAVING path = "/signup" | |
) fs | |
GROUP BY first_path | |
ORDER BY count DESC | |
LIMIT 100 |
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
-- contribution raking for signup using Treasure Data | |
SELECT contributed_path, COUNT(1) AS count | |
FROM ( | |
SELECT TD_SESSIONIZE(time, 3600, host) AS session_id, COLLECT_SET(path) AS contributed_paths | |
FROM ( | |
SELECT time, v['host'] as host, v['path'] as path | |
FROM www_access | |
DISTRIBUTE BY v['host'] | |
SORT BY v['host'], v['time'] | |
) ss | |
GROUP BY TD_SESSIONIZE(time, 3600, host) | |
HAVING path = "/signup" | |
) fs | |
LATERAL VIEW EXPLODE(contributed_paths) AS contributed_path | |
WHERE contributed_path != "/signup" | |
GROUP BY contributed_path | |
ORDER BY count DESC | |
LIMIT 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment