AWS S3 / Athena:如何在查询结果中接收JSON?


0

比方说,我在amazon-s3中有以下结构的消息:

{ "msg_type": "foo", "msg_body": { "str_field": "hello", "int_field": 1 } }

在Athena中执行以下查询时:

SELECT * FROM foo_table

它总是返回引号中的数字(参见“int_field”:“1”):

{"int_field":"1","str_field":"hello"}

如果我像这样修改消息:

{ "msg_type": "foo2", "msg_body": "{ \"str_field\": \"hello\", \"int_field\": 1 }" }

它返回普通的JSON对象:

{ "str_field": "hello", "int_field": 1 }

所以,我的问题是:

  1. 这是正常的行为吗?
  2. 如何执行查询,所以我可以接收普通的JSON对象,因为我需要复制粘贴它进行测试?

PS

1)我正在查看https://engineering.skybettingandgaming.com/2015/01/20/parsing-json-in-hive/,但我遇到以下错误:函数get_json_object未注册

2)我不能在亚马逊论坛上问它(可能,等几个小时,但我今天需要回答):你的帐户尚未准备好发布消息了。有关详细信息,请参阅以下文章:https//aws.amazon.com/premiumsupport/knowledge-center/error-forum-post/

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.