Hi, I have a table (Table A) with the following data :
name pid pflag pstr count ======================== ABC 502 01 0000 1 ABC 502 01 0010 2 ABC 502 01 0020 2 DEF 504 01 0101 1 GHI 502 00 0000 1 I want to put this data into another table(Table B) so that the data looks like : name pid pflag pstrcount ================================== ABC 502 01 {"0000":1;"0010":2;"0020":2} DEF 504 01 {"0101":1} GHI 502 00 {"0000":1} So pstrcount column is a map of the pstr and count from the Table A. Do I need to write custom UDAF to get this done or is there any way to achieve this out of the box using some Hive function/construct etc. I tried this query : create table B stored as sequencefile as select name,pid,pflag,map(pstr,count) as pstrcount from A; but got this output : ABC 502 01 {"0000":1} ABC 502 01 {"0010":2} ABC 502 01 {"0020":2} DEF 504 01 {"0101":1} GHI 502 00 {"0000":1} Could somebody please help. -- Thanks & Regards Himanish