aws athena-通过json对象数组创建表 [英] aws athena - Create table by an array of json object

查看:99
本文介绍了aws athena-通过json对象数组创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在AWS Athena上创建表方面获得帮助吗?有关数据的示例示例:

Can I get help in creating a table on AWS Athena. For a sample example of data :

[{"lts": 150}]

AWS Glue将模式生成为:

AWS Glue generate the schema as :

 array (array<struct<lts:int>>)

当我尝试使用AWS Glue创建的表预览表时,出现此错误:

When I try to use the created table by AWS Glue to preview the table, I had this error:

HIVE_BAD_DATA: Error parsing field value for field 0: org.openx.data.jsonserde.json.JSONObject cannot be cast to org.openx.data.jsonserde.json.JSONArray

消息错误很明显,但是我找不到问题的根源!

The message error is clear, but I can't find the source of the problem!

推荐答案

在AWS Athena下运行的配置单元正在使用

Hive running under AWS Athena is using Hive-JSON-Serde to serialize/deserialize JSON. For some reason, they don't support just any standard JSON. They ask for one record per line, without an array. In their words:

以下示例将起作用.

{ "key" : 10 }
{ "key" : 20 }

但这不会:

{
  "key" : 20,
}

也不是:

[{"key" : 20}]

这篇关于aws athena-通过json对象数组创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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