雅典娜使用S3表中的字段创建一个临时表。我已经使用JSON数据完成了此操作。您能帮我如何使用 Parquet 数据创建 table 吗?
我尝试了以下方法:
通过这样做,我可以执行查询,但结果为空。
这种方法是正确的还是对 Parquet 数据要遵循的其他任何方法?
样本json数据:
{"_id":"0899f824e118d390f57bc2f279bd38fe","_rev":"1-81cc25723e02f50cb6fef7ce0b0f4f38","deviceId":"BELT001","timestamp":"2016-12-21T13:04:10:066Z","orgid":"fedex","locationId":"LID001","UserId":"UID001","SuperviceId":"SID001"},
{"_id":"0899f824e118d390f57bc2f279bd38fe","_rev":"1-81cc25723e02f50cb6fef7ce0b0f4f38","deviceId":"BELT001","timestamp":"2016-12-21T13:04:10:066Z","orgid":"fedex","locationId":"LID001","UserId":"UID001","SuperviceId":"SID001"}
最佳答案
如果您的数据已成功以Parquet格式存储,则可以创建一个引用这些文件的表定义。
这是一个使用Parquet文件的示例语句:
CREATE EXTERNAL TABLE IF NOT EXISTS elb_logs_pq (
request_timestamp string,
elb_name string,
request_ip string,
request_port int,
...
ssl_protocol string )
PARTITIONED BY(year int, month int, day int)
STORED AS PARQUET
LOCATION 's3://athena-examples/elb/parquet/'
tblproperties ("parquet.compress"="SNAPPY");
该示例摘自AWS博客文章Analyzing Data in S3 using Amazon Athena,在解释Amazon Athena中使用压缩和分区数据的好处方面做得非常出色。
关于amazon-web-services - 如何从Amazon Athena查询 Parquet 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42786398/