我有一个 Athena 表,每天都有一个分区,其中实际文件按小时位于“子目录”中,如下所示:
s3://my-bucket/data/2019/06/27/00/00001.json
s3://my-bucket/data/2019/06/27/00/00002.json
s3://my-bucket/data/2019/06/27/01/00001.json
s3://my-bucket/data/2019/06/27/01/00002.json
Run Code Online (Sandbox Code Playgroud)
Athena 能够毫无问题地查询此表并找到我的数据,但在使用 AWS Glue 时,它似乎无法找到此数据。
ALTER TABLE mytable ADD
PARTITION (year=2019, month=06, day=27) LOCATION 's3://my-bucket/data/2019/06/27/01';
select day, count(*)
from mytable
group by day;
day . count
27 . 145431
Run Code Online (Sandbox Code Playgroud)
我已经尝试将分区的位置更改为以斜杠 ( s3://my-bucket/data/2019/06/27/01/)结尾,但这没有帮助。
以下是 Glue 中的分区属性。我希望 storedAsSubDirectories 设置会告诉它迭代子目录,但情况似乎并非如此:
{
"StorageDescriptor": {
"cols": {
"FieldSchema": [
{
"name": "userid",
"type": "string",
"comment": ""
},
{
"name": "labels",
"type": "array<string>",
"comment": ""
}
]
},
"location": "s3://my-bucket/data/2019/06/27/01/",
"inputFormat": "org.apache.hadoop.mapred.TextInputFormat",
"outputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat",
"compressed": "false",
"numBuckets": "0", …Run Code Online (Sandbox Code Playgroud)