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

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

问题描述

我已经尝试了 Amazon 为 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启动 hive 后,只需使用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 数组的 Hive 的 JSON SerDe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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