一条数据拆分成多条
concat_ws(分隔符,字段) from xxx group by (hive里面的explode)
原始数据为
id | value |
1 | 1,2,3,4 |
2 | 2,3,4,5,6 |
拆分成:
id | value |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
6 | 6 |
select
distinct substring_index(substring_index(a.value,',',b.help_topic_id+1),',
concat_ws(分隔符,字段) from xxx group by (hive里面的explode)
原始数据为
id | value |
1 | 1,2,3,4 |
2 | 2,3,4,5,6 |
拆分成:
id | value |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
6 | 6 |
select
distinct substring_index(substring_index(a.value,',',b.help_topic_id+1),',