如何更改表A中的数据结构? 它应该看起来像表B. 我在Hive 0.13.1
工作A
id |DATA
6ZE, FET, UZX |50048
UZC, LQY |89871
LQY, E03 |31579
HO7, 7KT, LXW, EK8 |17260
乙
id |DATA
6ZE |50048
FET |50048
UZX |50048
UZC |89871
LQY |89871
LQY |31579
E03 |31579
HO7 |17260
7KT |17260
LXW |17260
EK8 |17260
答案 0 :(得分:1)
select trim(e.id) as id,t.data from t lateral view explode (split(id,',')) e as id;
hive> select trim(e.id) as id,t.data from t lateral view explode (split(id,',')) e as id;
OK
6ZE 50048
FET 50048
UZX 50048
UZC 89871
LQY 89871
LQY 31579
E03 31579
HO7 17260
7KT 17260
LXW 17260
EK8 17260
Time taken: 0.233 seconds, Fetched: 11 row(s)
hive>