在 Athena 中重命名列 [英] Rename Column in Athena

查看:43
本文介绍了在 Athena 中重命名列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Athena 表组织"从 s3 中的镶木地板文件读取数据.我需要将列名从 "cost" 更改为 "fee" .数据文件可以追溯到 2018 年 1 月.如果我只是重命名 Athena 中的列,表将无法在 Parquet 文件中找到新列的数据.请告诉我是否有解决方法.

Athena table "organization" reads data from parquet files in s3. I need to change a column name from "cost" to "fee" . The data files goes back to Jan 2018. If I just rename the column in Athena , table won't be able to find data for new column in parquet file. Please let me know if there ways to resolve it.

推荐答案

您必须更改架构并指向新列费用"

You have to change the schema and point to new column "fee"

但这取决于你的情况.

  • 如果您有两个数据集,在一个数据集中它称为成本",而在另一个数据集中称为费用".如果是这种情况,那就很难了,需要更多思考.

  • If you have two data sets, in one dataset it is called "cost" and in another dataset it is called "fee". If this is the case then it is quite difficult and needs more thinking.

如果镶木地板文件称其为成本",但在 athena 中您想通过费用"查询它.在这种情况下,添加一个名为费用的新列.将架构从成本 -> 成本更改为成本 -> 费用

If the parquet files calls it "cost" but in athena you want query it by "fee". In this case add a new column called fee. Change the schema from cost -> cost to cost -> fee

这篇关于在 Athena 中重命名列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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