Created
October 4, 2013 19:57
-
-
Save milimetric/6831839 to your computer and use it in GitHub Desktop.
Hive script to create an internal table and insert hourly data aggregated at the daily level.
This file contains hidden or 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
DROP TABLE IF EXISTS milimetric_pagecounts_daily; | |
CREATE TABLE IF NOT EXISTS milimetric_pagecounts_daily( | |
project string, | |
page string, | |
views int, | |
bytes int, | |
year int, | |
month int, | |
day int | |
) | |
ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ' | |
LOCATION '/user/milimetric/pagecounts_daily' | |
; | |
INSERT INTO TABLE milimetric_pagecounts_daily | |
SELECT project, | |
page, | |
sum(views), | |
sum(bytes), | |
year, | |
month, | |
day | |
FROM milimetric_pagecounts | |
WHERE year = 2013 | |
GROUP BY project, page, year, month, day | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment