小编Fru*_*rai的帖子

亚马逊雅典娜分区表

我正在尝试按年,月和日对Amazon Athena查询的数据进行分区。但是,当我尝试从分区数据查询时,无法获得任何记录。我按照此博客文章中的说明进行操作。

创建表查询:

CREATE external TABLE mvc_test2 (
ROLE struct<Scope: string, Id: string>,
ACCOUNT struct<ClientId: string, Id: string, Name: string>,
USER struct<Id: string, Name: string>,
IsAuthenticated INT,
Device struct<IpAddress: string>,
Duration double,
Id string,
ResultMessage string,
Application struct<Version: string, Build: string, Name: string>,
Timestamp string,
ResultCode INT
)
Partitioned by(year string, month string, day string)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://firehose-titlesdesk-logs/Mvc/'
Run Code Online (Sandbox Code Playgroud)

该表已成功创建,并且结果消息显示:

“查询成功。如果表具有分区,则需要加载这些分区才能查询数据。可以加载所有分区,也可以分别加载它们。如果使用加载所有分区(MSCK REPAIR TABLE)命令,则分区必须采用Hive可以理解的格式。了解详情。”

跑步

msck repair table mvc_test2;
Run Code Online (Sandbox Code Playgroud)

我得到结果:

“分区不在Metastore中:mvc_test2:2017/06/06/21 mvc_test2:2017/06/06/22”

此时,当我尝试查询表时没有任何结果。

日志以年/月/日/小时的子文件夹格式存储。例如:“ s3:// firehose-application-logs / …

hive amazon-web-services presto amazon-athena

2
推荐指数
2
解决办法
5056
查看次数

标签 统计

amazon-athena ×1

amazon-web-services ×1

hive ×1

presto ×1