I have a data table with two columns ID and Details that looks like:
Here is the code to create the above dataset:
select stack(4,
115,array(map('AA_Desc', 'Sale', 'AA_Date', '202403', 'AA_Block', '0')),
214,array(map('AA_Desc', 'Ret', 'AA_Date', '202402', 'AA_Block', '1')),
54,array(map('AA_Desc', 'Sale', 'AA_Date', '202312', 'AA_Block', '0')),
31, array(map('AA_Desc', 'Can', 'AA_Date', '202312'), map('AA_Desc', 'Ret', 'AA_Date', '202312','AA_Block', '0'))
) as (id, arr_col)
The data type for column 'details' is array<map<string,string>>
and I want to extract certain values from the details field for every ID. Ideally an output in the below format would be great either in HIVE or Impala. I have not worked with this data type structure before so any help would be appreciated. Thanks
Output: