问题描述
我有桌子
create table regs(
id string,regs string)
数据示例
id regs
1 23:7:97.27%,77:1:0.56%,09:1:0.48%
2 01:3:1.26%,15:1:0.09%
3 26:1:0.17%
我如何获得此结果?
id regs
1 23:7:97.27%
1 77:1:0.56%
1 09:1:0.48%
2 01:3:1.26%
2 15:1:0.09%
3 26:1:0.17%
解决方法
使用这种模式',*'
分割regs-表示逗号+任意数量的空格,并爆炸:
select r.id,e.reg
from regs r
lateral view explode(split(r.regs,',*')) e as reg