how to add columns to existing hive partitioned table?

Veeru Chow picture Veeru Chow · Nov 14, 2016 · Viewed 18.2k times · Source
alter table abc add columns (stats1 map<string,string>, stats2 map<string,string>)

i have altered my table with above query. But after while checking the data i got NULL's for the both extra columns. I'm not getting data.

screenshot

Answer

Pravat Sutar picture Pravat Sutar · Jun 30, 2017

CASCADE is the solution.

Query:

ALTER TABLE dbname.table_name ADD columns (column1 string,column2 string) CASCADE; 

This changes the columns of a table's metadata and cascades the same change to all the partition metadata. RESTRICT is the default, limiting column change only to table metadata.