将JSON数据加载到配置单元表中

时间:2017-03-31 10:03:17

标签: json hive hive-serde

我尝试将文件中的简单JSON记录加载到hive表中,如下所示。每个{"Industry":"Manufacturing","Phone":null,"Id":null,"type":"Account","Name":"Manufacturing"} {"Industry":null,"Phone":"(738) 244-5566","Id":null,"type":"Account","Name":"Sales"} {"Industry":"Government","Phone":null,"Id":null,"type":"Account","Name":"Kansas City Brewery & Co"} 记录都在一个单独的行中。

serde

但我找不到任何(,)将逗号JSON分隔的JSON记录数组加载到配置单元表中。输入是一个包含[{"Industry":"Manufacturing","Phone":null,"Id":null,"type":"Account","Name":"Manufacturing"},{"Industry":null,"Phone":"(738) 244-5566","Id":null,"type":"Account","Name":"Sales"},{"Industry":"Government","Phone":null,"Id":null,"type":"Account","Name":"Kansas City Brewery & Co"}] 条记录的文件,如下所示......

serde

有人可以建议我JSON来解析这个{{1}}文件吗?

由于

1 个答案:

答案 0 :(得分:-1)

您可以查看此服务:https://github.com/rcongiu/Hive-JSON-Serde

另一篇相关帖子:Parse json arrays using HIVE