0

我正在尝试使用 Amazon Athena 查询使用 zstd 压缩的 JSON 文件。

DDL:

CREATE EXTERNAL TABLE IF NOT EXISTS reddit_comments (
  distinguished STRING,
  body STRING,
  created_utc INT,
  subreddit STRING,
  score INT,
  author STRING
  ) 
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://my-bucket/test/';

询问:

SELECT * FROM reddit_comments  
LIMIT 10

查询导致错误:Row is not a valid JSON Object - JSONException: Expected a ':' after a key at 10 [character 11 line 1]

我试过的

  • 当我在解压缩文件上使用相同的 DDL 运行相同的查询时,它可以工作。
  • 我的压缩文件扩展名.zstd不是默认的.zst.

可重现的例子

将以下记录保存在用 ZSTD 压缩的文件中。

{"distinguished":null,"author":"dons","score":7,"created_utc":1170288047,"subreddit":"programming","body":"Hehe. "}
{"created_utc":1170288055,"score":1,"subreddit":"reddit.com","body":"Plop","distinguished":null,"author":"indigoshift"}

并且使用与上述相同的 DDL 和查询,Athena 将仅返回空白字段。

4

0 回答 0