如何修改Hive分区列名

如何修改Hive分区列名

本文介绍了如何修改Hive分区列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须更改分区列名称(不是分区规格),我查找了配置单元wiki和一些谷歌页面中的命令。我可以找到更改分区规范的选项,即

即。例如



在/ table / country ='US'我可以将美国更改为美国,但我想更改国家大陆



我觉得可用于更改分区列名的唯一选项是删除并重新创建表。是否有其他选择可用,请帮助我。



预先致谢。

解决方案

div>

您可以通过以下方式更改元数据中的列名:



但是正如文件所说,它只会改变元数据。 Hive分区实现为具有命名模式columnName = spec的目录。因此,您还需要使用hadoop fs命令更改HDFS上这些目录的名称。


I have to change the partition column name (not partition spec), I looked for the commands in hive wiki and some google pages. I can find the options for altering the partition spec,

i.e. For example

In /table/country='US' I can change US to USA, but I want to change country to continent.

I feel like the only option available for changing partition column name is dropping and re-creating the table. Is there is any other option available please help me.

Thanks in advance.

解决方案

You can change column name in metadata by following:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-ChangeColumnName/Type/Position/Comment

But as the document says, it only changes the metadata. Hive partitions are implemented as directories with the naming pattern columnName=spec. So you also need to change the names of those directories on HDFS by using "hadoop fs" command.

这篇关于如何修改Hive分区列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 16:11