gpt4 book ai didi

json - pig 。 JsonLoader。加载没有架构的嵌套对象

转载 作者:可可西里 更新时间:2023-11-01 16:15:05 24 4
gpt4 key购买 nike

我有 jsons,我想将它加载到 pig。每个 json 看起来像这样:

{"timeStamp":1397718396509,"requestUid":"534F7D320007","result":
{//many many different objects}

而且我无法为字段 result 提供架构,因为它不是常量,而且非常大。所以我想将它加载为字符数组、 map 或其他东西——没关系。但它应该加载,因为稍后将需要它。我试过这样的事情:

LOAD 'log' USING JsonLoader('timestamp:long, req_id:chararray, result:chararray');

但我得到一个空的结果 字段。实现我想要的目标的最简单方法是什么?

最佳答案

使用Elephant Bird自带的json loader (来自推特)。它将加载嵌套的 Json,而无需提前指定架构。

关于json - pig 。 JsonLoader。加载没有架构的嵌套对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23196160/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com