hive读取json文件

Posted 宋------

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hive读取json文件相关的知识,希望对你有一定的参考价值。

这里是引用

hive

create table sw.json_test(
name string,
age string,
depId string,
gender string,
salary string
)partitioned by (biz_date int)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe';
-- 需要上传 json-serde-1.3.8-jar-with-dependencies.jar 到 hive的lib目录下面

json数据

"name": "Leo", "age": 25, "depId": 1, "gender": "male", "salary": 20000.126
"name": "Marry", "age": 30, "depId": 2, "gender": "female", "salary": 25000
"name": "Jack", "age": 35, "depId": 1, "gender": "male", "salary": 15000
"name": "Tom", "age": 42, "depId": 3, "gender": "male", "salary": 18000
"name": "Kattie", "age": 21, "depId": 3, "gender": "female", "salary": 21000
"name": "Jen", "age": 19, "depId": 2, "gender": "male", "salary": 8000
"name": "Jen", "age": 30, "depId": 2, "gender": "female", "salary": 28000
"name": "Tom", "age": 42, "depId": 3, "gender": "male", "salary": 18000
"name": "XiaoFang", "age": 18, "depId": 3, "gender": "female", "salary": 58000

以上是关于hive读取json文件的主要内容,如果未能解决你的问题,请参考以下文章

使用 hive/sql 和 spark 读取 json 键值

Hive处理Json数据

大数据Hive JSON数据处理

大数据NiFi(十九):实时Json日志数据导入到Hive

大数据之Hive:get_json_object函数使用

Hive系列之解析JSON数据