问题描述
我可以在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-JSON-Serde 来对JSON进行序列化/反序列化.由于某些原因,它们不只支持任何标准JSON.他们要求每行一条记录,没有数组.用他们的话说:
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对象数组创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!