重命名雅典娜中的列 [英] Rename Column in Athena

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

问题描述

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

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.

推荐答案

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

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.

如果实木复合地板文件将其称为成本",但是在雅典娜中,您需要通过费用"进行查询.在这种情况下,请添加一个新列,称为费用".将架构从成本->成本更改为成本->费用

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

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

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