Reputation: 3071
I have a hive table with one of the column as map data type .
map<int,struct<id :bigint,QTY:decimal(12,4),DISC_AMT:decimal(20,4),DISC_TYPE:string>>
Now I want to add one column inside the struct values like below:
map<int,struct<id :bigint,QTY:decimal(12,4),DISC_AMT:decimal(20,4),DISC_TYPE:string,new_column :int>>
Anyone know how to achieve this .
Thanks in advance.
Upvotes: 2
Views: 817
Reputation: 44991
alter table t change column mycol mycol map<int,struct<id:bigint,QTY:decimal(12,4),DISC_AMT:decimal(20,4),DISC_TYPE:string,new_column:int>>;
Notice that by default only new partitions will be impacted from the change.
If you want this to apply to all partitions add the word cascade
at the end
Upvotes: 1
Reputation: 3071
Found the solution:
alter table tablename change my_map_name my_map_name map<int,struct<id :bigint,QTY:decimal(12,4),DISC_AMT:decimal(20,4),DISC_TYPE:string,new_column :int>>;
Upvotes: 0