蜂巢:强制转换数组

问题描述:

我有一个蜂巢表

name            string                                      
address         string                                      
timezone        string                                      
one_key_value   array<struct<key:string,value:array<string>>                    
two_key_value   array<struct<key:string,value:array<string>>

并希望将其转换为

name            string                                      
address         string                                      
timezone        string                                      
one_key_value   map<string,array<string>>                       
two_key_value   map<string,array<string>>

explode(array),但实际上并没有以我想要的格式返回整个表.

There is explode(array) but doesn't really return the entire table in the format I want.

lateral viewinlinemap用作结果键和值.

Use lateral view with inline and map the resulting keys and values.

select name,address,timezone,map(k1,v1),map(k2,v2)
from tbl 
lateral view inline(one_key_value) t1 as k1,v1
lateral view inline(two_key_value) t1 as k2,v2