hive表行转列和列转行
t1
item | num |
---|---|
A | 1,2,3,4 |
B | 2,5,1 |
行转列(lateral view explode)
--使用侧视图lateral view explode进行行转列
create table t3 as with r1 as (select item ,nums from t1 lateral view explode(split(num,",")
item | num |
---|---|
A | 1,2,3,4 |
B | 2,5,1 |
行转列(lateral view explode)
--使用侧视图lateral view explode进行行转列
create table t3 as with r1 as (select item ,nums from t1 lateral view explode(split(num,",")