I have a table with a structure like this:
column1, column2, column3, X1, X2, X3, X4
A1, A2, A3, 5, 6, 1, 4
I would like
Whoops, posted this in a hurry it seems. I have the answer. Posting it here for others who might find this useful. Here is the correct syntax to deal with map and explode to achieve this.
select column1, column2, column3, m_key, m_val from
(select column1, column2, column3, map("X1", X1, "X2", X2, "X3", X3, "X4", X4) as map1
from table1) as t1
lateral view explode(map1) xyz as m_key, m_val