How to alter Hive partition column name

15,913

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.

Share:
15,913
Sunil
Author by

Sunil

Updated on September 18, 2022

Comments

  • Sunil
    Sunil over 1 year

    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.