支持JSON数组的JSON SerDe for Hive [英] JSON SerDe for Hive that supports JSON arrays

查看:167
本文介绍了支持JSON数组的JSON SerDe for Hive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过了亚马逊为EMR实例提供的JSON SerDe,并且如果您需要将JSON字典字段映射到/映射到列,则效果很好。但是我无法想象如何对JSON数组做同样的工作。例如,如果有一个JSON数组如下:

I have tried the JSON SerDe that Amazon provides for EMR instance and works great if you need to address/map JSON dictionary fields to columns. However I wasn't been able to figure how to do the same with JSON arrays. For example if there is a JSON array as follows:


[23123.32,Text Text,{key1:value1} ]

[23123.32, "Text Text", { "key1": "value1" } ]

有没有办法将数组的第一个元素映射到Hive表中的列?怎么样嵌入字典字段?

Is there a way to map the first element of an array to a column in Hive table? What about the embedded dictionary fields?

推荐答案

我一直在努力解决同样的问题,直到我发现github上的这个serde -
https://github.com/rcongiu/Hive-JSON-Serde
一旦开始配置单元,只需使用'add jar'命令就可以包含它,它就像一个魅力一样。

I was struggling with the same problem till I found this serde on github - https://github.com/rcongiu/Hive-JSON-Serde Just include it using the 'add jar' command once you start hive and it works like a charm.

这篇关于支持JSON数组的JSON SerDe for Hive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆