Support Questions

Find answers, ask questions, and share your expertise

Alter external hive table fails

avatar
New Contributor

Alter table on the following external table fails:

CREATE EXTERNAL TABLE IF NOT EXISTS MODULES_1 ( `ModuleID` string ,

`ModuleName` string , `ContractType` string )

PARTITIONED BY ( meta_version string, year string, month string, day string)

ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe'

WITH SERDEPROPERTIES ( "field.delim"="\t")

LOCATION '/tst/raw/comarch/modules/1'tblproperties("skip.header.line.count"="3");

When I try to modify this table using below:

Alter table MODULES_1 ADD COLUMNS(`OperationType` string)

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Error: type expected at the position 0 of '<derived from deserializer>:<derived from deserializer>:<derived from deserializer>:string' but '<' is found.

I tried it with partition specifications:

Alter table MODULES_1 PARTITIONS(meta_version,`year`,`month`,`day`) ADD COLUMNS(`OperationType` string)

that also fails.

Please suggest a workwround

3 REPLIES 3

avatar

@Naveen Dabas

It should work actually. Try removing the '`' and execute it. Orelse the other way is to drop the table and re-create it. As it an external table it wont affect the data. Hope it helps!!

avatar
New Contributor

I did it with quotes removed. The other thing of dropping and recreating the table is not a viable option for me since it will remove all the partition information. And then I have to again add all the partitions manually using add partition command.

avatar
Explorer

I know its a old post. But I am getting the same error. In my case it working fine with CDH 5.13 buth then we upgraded our cluster to CDH 6.3.4. It is not working now. I am getting the same error as mentioned above while trying to add columns to a hive table with MultiDelimiterSerde.