'Error - Drop column of a partitioned table in Hive

How do I drop a column of a partiotioned table in Hive? I have an external table with 4 columns, for example:

column_A

column_B

column_C

dt_test - partition

I have to drop the column_C, so, I'm trying the follow command:

ALTER TABLE TABLE REPLACE COLUMNS(column_A string, column_B string, dt_test timestamp);

The follow error occurs:

Error while compiling statement: FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. Partition column name dt_test conflicts with table columns.

Thanks!



Solution 1:[1]

You can drop column_c by the follow command:

ALTER TABLE TABLE REPLACE COLUMNS(column_A string, column_B string);

not having the partition column: dt_test timestamp

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chaplinthink