如何在配置单元0.13.1中使用csv数据分解字符串列

gojuced7  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(299)

如何更改表a中的数据结构?它应该像表b。我在Hive0.13.1中工作

id                 |DATA
6ZE, FET, UZX      |50048
UZC, LQY           |89871
LQY, E03           |31579
HO7, 7KT, LXW, EK8 |17260

b

id  |DATA
6ZE |50048
FET |50048
UZX |50048
UZC |89871
LQY |89871
LQY |31579
E03 |31579
HO7 |17260
7KT |17260
LXW |17260
EK8 |17260
lnxxn5zx

lnxxn5zx1#

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>

相关问题