amazon-athena

How to get input file name as column in AWS Athena external tables

孤者浪人 提交于 2019-11-27 01:04:37
问题 I have external tables created in AWS Athena to query S3 data, however, the location path has 1000+ files. So I need the corresponding filename of the record to be displayed as a column in the table. select file_name , col1 from table where file_name = "test20170516" In short, I need to know INPUT__FILE__NAME(hive) equivalent in AWS Athena Presto or any other ways to achieve the same. 回答1: You can do this with the $path pseudo column. select "$path" from table 回答2: If you need just the

Can you use a column for the timezone parameter of AT TIME ZONE in Presto / Athena?

时光毁灭记忆、已成空白 提交于 2019-11-26 22:12:16
问题 Here is an operation you can perform in Athena- SELECT date_utc AT TIME ZONE 'America/Chicago' FROM ( SELECT TIMESTAMP '2018-09-09 12:00:00' as date_utc ) x; In other sql engines you can change America/Chicago to a column- SELECT date_utc AT TIME ZONE x.timezone FROM ( SELECT TIMESTAMP '2018-09-09 12:00:00' as date_utc, 'America/Chicago' as timezone ) x; In Athena you get- line 1:30: no viable alternative at input 'time zone x' Should it be possible to use x.timezone in Athena? This seems