Suppose we have
columnsA columnsB
1 {'A':22,'B':11}
2 {'A':13,'C':24}
How to convert it to
columnsA A B C
1 22 11 NA
2 13 NA 24
select m['A'] A,
m['B'] B,
m['C'] C
from (select str_to_map("A:22,B:11") m) s;
Returns:
A B C
22 11 NULL
If you need 'NA' instead of NULL, use NVL() function:
NVL(m['A'],'NA') as A