gpt4 book ai didi

presto - 从 AWS Athena/Presto 查询结构字段

转载 作者:行者123 更新时间:2023-12-04 01:39:58 25 4
gpt4 key购买 nike

我将为这个站点做一个简化的例子,但基本上我正在尝试编写一个 Athena 查询(由 Glue 爬虫加载的数据,意图在 Quicksight 中使用),这将允许我在 select 语句中扩展一个结构。

在我的例子中,假设我有一张表 my_table这类似于:

id string,
scores struct<prediction:double,score:int>

但由于我不知道 scores 查询时的确切结构列,我想在查询范围内扩展它。

我尝试了很多组合,但只使用结构内嵌套字段的确切名称似乎会产生结果,即
select results.id, results.scores.score, results.scores.prediction from my_table results

如果类似 select results.id, results.scores.* from my_table results,我会喜欢它工作,但不幸的是它没有。

最佳答案

I would like it if something like select results.id, results.scores.* from my_table results worked, but unfortunately it doesn't.


您要求的是“广义所有字段引用”。
Presto 323 开始,它在 Presto 中可用.
您可以从 https://trino.io/download.html 下载最新的 Presto 版本.
如果您使用的是 Athena,那么不幸的是,Athena 当前基于 Presto .172(3 年前发布),因此该功能在那里不可用。在 Athena 升级之前,您无法在 SQL 级别应用任何解决方法。您需要在从 Athena 读取数据的应用程序中对此进行补偿。或者,您可以 deploy recent Presto version on AWS easily .

关于presto - 从 AWS Athena/Presto 查询结构字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57892423/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com