hive导入json数据

 jar 下载 http://www.congiu.net/hive-json-serde/
 add jar json-serde-1.3.6-jar-with-dependencies.jar;
CREATE TABLE relation (
fan_id string,
followed_id string
) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE;
CREATE TABLE comments (
weibo_url string,
comment_user_id string,
content string,
created_at string
) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE;
CREATE TABLE tweets (
weibo_url string,
user_id string,
comment_user_id string,
content string,
created_at string,
like_num  int,
repost_num  int,
comment_num  int
) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE;
LOAD DATA LOCAL INPATH '/tmp/data/comments.bat' OVERWRITE INTO TABLE  comments;

hivClassNotFoundException: Class org.apache.hive.hcatalog.data.JsonSerDe not found
添加
ADD JAR /usr/local/hive-2.3.4/lib/hive-hcatalog-core-2.3.4.jar

你可能感兴趣的:(hive)