Support Questions
Find answers, ask questions, and share your expertise

How to rename partition value in Hive?

Solved Go to solution
Highlighted

How to rename partition value in Hive?

We have a table with partitions as p_date/p_workflow/p_attempt, we have data in p_date as "2016-10-15" which we need to change to "2015-10-15". Query we used is "alter table "table_name" partition (p_date='2016-10-15' ,p_workflow_id='0000450-151026183415051-oozie-oozi-W', p_attempt=0) rename to partition (p_date='2015-10-25' ,p_workflow_id='0000450-151026183415051-oozie-oozi-W', p_attempt=0);" which is yielding error "FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to rename partition."

Hive version is Hive 0.13.0.2.1.3.0-563

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to rename partition value in Hive?

Rising Star

@Nilesh Shrimant There is an issue with renaming partitions in hive 0.13 which is fixed in hive 0.14 I guess.

Possible workaround -

Setting fs.hdfs.impl.disable.cache=false and fs.file.impl.disable.cache=false

Refer https://issues.apache.org/jira/browse/HIVE-7623 for more details.

View solution in original post

4 REPLIES 4
Highlighted

Re: How to rename partition value in Hive?

Rising Star

@Nilesh Shrimant There is an issue with renaming partitions in hive 0.13 which is fixed in hive 0.14 I guess.

Possible workaround -

Setting fs.hdfs.impl.disable.cache=false and fs.file.impl.disable.cache=false

Refer https://issues.apache.org/jira/browse/HIVE-7623 for more details.

View solution in original post

Highlighted

Re: How to rename partition value in Hive?

Mentor

@Nilesh Shrimant has this been resolved? Can you post your solution or accept the best answer?

Re: How to rename partition value in Hive?

Rising Star

As @Gangadhar Kadam said it has problem in 0.13 but works fine in 0.14

Highlighted

Re: How to rename partition value in Hive?

@Gangadhar Kadam , thanks for the suggestion, but we circumvent the problem in an unethical way. We took table backup and then renamed partitions in Hive warehouse and then ran msck repair table command. It created new partitions in Hive which were renamed and then we created directories with old partition names and dropped them with drop partition command deleting metastore entry.