Skip to content

Instantly share code, notes, and snippets.

@tangyl
Created October 31, 2018 05:17
Show Gist options
  • Save tangyl/5a2b05fad97be06e3888d94f041ca397 to your computer and use it in GitHub Desktop.
Save tangyl/5a2b05fad97be06e3888d94f041ca397 to your computer and use it in GitHub Desktop.
create hive external table with schema from json
create external table if not exists {{table_name}}(
url string,
title string,
duration int,
play_count int,
created_time bigint,
last_crawl_time bigint
)
ROW FORMAT SERDE
'org.openx.data.jsonserde.JsonSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
location "{{hdfs_or_s3_location}}";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment