如何获取输入文件名作为 AWS Athena 外部表中的列 [英] How to get input file name as column in AWS Athena external tables

查看:25
本文介绍了如何获取输入文件名作为 AWS Athena 外部表中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 AWS Athena 中创建了外部表来查询 S3 数据,但是,位置路径有 1000 多个文件.所以我需要将记录的对应文件名显示为表格中的一列.

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"

简而言之,我需要知道在 AWS Athena Presto 中等效的 INPUT__FILE__NAME(hive) 或任何其他实现相同目的的方法.

In short, I need to know INPUT__FILE__NAME(hive) equivalent in AWS Athena Presto or any other ways to achieve the same.

推荐答案

您可以使用 $path 伪列执行此操作.

You can do this with the $path pseudo column.

select "$path" from table

这篇关于如何获取输入文件名作为 AWS Athena 外部表中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆