Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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

1 REPLY 1

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!!