hive map类型转多行
Posted 伴生伴熟
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hive map类型转多行相关的知识,希望对你有一定的参考价值。
map类型转多行
将“a”:“b”,“c”:“d”,“e”:“f”转成3行
SELECT a.c1,
a.c_map,
b.map_key,
b.map_value
FROM (
SELECT 'test' AS c1,
MAP('a', 'b', 'c', 'd', 'e', 'f') AS c_map
) a
LATERAL VIEW
EXPLODE(c_map) b AS map_key,
map_value;
输出结果
c1 c_map map_key map_value
test "a":"b","c":"d","e":"f" a b
test "a":"b","c":"d","e":"f" c d
test "a":"b","c":"d","e":"f" e f
以上是关于hive map类型转多行的主要内容,如果未能解决你的问题,请参考以下文章