Rename Column in Athena

时光总嘲笑我的痴心妄想 提交于 2021-01-28 14:27:05

问题


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.


回答1:


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

But it depends on ur situation.

  • 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



来源:https://stackoverflow.com/questions/55029107/rename-column-in-athena

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!