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

change datatype of external table

Expert Contributor

I had a external table that contains some string columns, now I need to change the datatype of some columns, so I used :

ALTER TABLE table CHANGE col col type;

but this query gives me a error:

org.apache.spark.sql.AnalysisException: ALTER TABLE CHANGE COLUMN is not supported for changing column 'id' with type 'StringType' to 'id' with type 'LongType';

any suggestion would be greatly welcome, thanks


Super Guru

Specify type as BigInt which is Equivalent to long type,hive don't have long datatype.

for more reference