Created
April 21, 2016 14:19
-
-
Save laughingman7743/e4085226aebd8bb72f78627042cbb8e6 to your computer and use it in GitHub Desktop.
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
ADD JAR /usr/lib/hive-hcatalog/share/hcatalog/hive-hcatalog-core-1.0.0-amzn-3.jar; | |
CREATE EXTERNAL TABLE IF NOT EXISTS test_json_table | |
( | |
_id bigint, | |
column1 string, | |
column2 string, | |
column3 string, | |
column4 string, | |
column5 string | |
) | |
PARTITIONED BY(year string, month string, day string, hour string) | |
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' STORED AS TEXTFILE | |
LOCATION 's3://YOUR_BUCKET/path/to/json/'; |
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
SET hive.exec.dynamic.partition.mode=nonstrict; | |
SET hive.exec.compress.output=true; | |
SET io.seqfile.compression.type=BLOCK; | |
SET mapred.output.compression.codec = org.apache.hadoop.io.compress.GzipCodec; | |
ADD JAR /usr/lib/hive-hcatalog/share/hcatalog/hive-hcatalog-core-1.0.0-amzn-3.jar; | |
INSERT OVERWRITE TABLE test_json_table | |
PARTITION(year, month, day, hour) | |
SELECT | |
_id, | |
column1, | |
column2, | |
column3, | |
column4, | |
column5, | |
year, | |
month, | |
day, | |
hour | |
FROM test_table; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment