Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add columns to existing hive partitioned table?

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

like image 738
Veeru Chow Avatar asked Nov 14 '16 05:11

Veeru Chow


1 Answers

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.

like image 156
Pravat Sutar Avatar answered Nov 05 '22 05:11

Pravat Sutar