AWS雅典娜:带有非标准文件结构的S3存储桶的分区表

发布于 2025-01-23 08:16:53 字数 859 浏览 3 评论 0原文

我是雅典娜的新手,我很难了解分区的工作原理以及它是否可以对我有用。

我以以下格式有S3中的文件: path/to/files/yyyymmddthhmmsssz_< id> .json

例如:

path/to/files/20191208T130435Z_265901.json
path/to/files/20191212T132019Z_266406.json
path/to/files/20191216T102909Z_266975.json
path/to/files/20191226T095326Z_268789.json
path/to/files/20191226T103749Z_268798.json
path/to/files/20191226T110113Z_268802.json
path/to/files/20191229T182902Z_269391.json
path/to/files/20191230T041315Z_269481.json
path/to/files/20200101T200007Z_269935.json
...

我知道这不遵循正确的蜂巢风格分区的准则,但我不是数据所有者,但是我不是数据的所有者,所以这不会改变。

我的问题是:是否有任何方法可以指定每月的分区?

我正在阅读本指南但是我不确定是否以及如何适用于我的案件。

非常感谢。

I'm very new to Athena and I'm having a little bit of hard time understanding how partitioning works and if it can work for me.

I have files in S3 in the following format:
path/to/files/YYYYmmDDTHHMMSSZ_<id>.json

For example:

path/to/files/20191208T130435Z_265901.json
path/to/files/20191212T132019Z_266406.json
path/to/files/20191216T102909Z_266975.json
path/to/files/20191226T095326Z_268789.json
path/to/files/20191226T103749Z_268798.json
path/to/files/20191226T110113Z_268802.json
path/to/files/20191229T182902Z_269391.json
path/to/files/20191230T041315Z_269481.json
path/to/files/20200101T200007Z_269935.json
...

I understand that this does not follow the guidelines for correct hive-style partitioning, but I'm not the owner of the data, so this cannot change.

My question is: Is there any way to specify a monthly partition to such a structure?

I'm reading this guide but I'm not sure if and how it applies to my case.

Thanks a lot in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

原来是傀儡 2025-01-30 08:16:53

您可以预处理数据并将其重命名,以具有正确的目录结构。

对于Ex:

  1. 对象上传
  2. 发送S3 PUT事件到Lambda(仔细设置以不干扰步骤3)
  3. 复制+删除此对象以纠正目录结构。

You can pre-process your data, and rename them, to have proper directory structure.

For ex:

  1. Object uploaded
  2. Send S3 PUT event to lambda (setup it carefully to not interfere with step 3)
  3. Copy+delete this object to correct directory structure.
土豪 2025-01-30 08:16:53

因此,在更仔细地阅读文档后,我认为答案是“否”。如果我在“ yyyymmdd”之后有一个定界符(“/”),则可以通过分区投影,但是由于没有,也不会发生这种情况。

似乎没有其他方法可以解决解决方案@Alex所建议的。

So, after reading the documentation more carefully, I think the answer is "no". If I had a delimiter ("/") after "YYYYmmDD", then this would be possible by partition projection, but since there is not, this cannot happen either.

It seems there is no other way as the workaround @Alex has suggested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文