with table1 as (
select row_number() over () as id, values
from initial_table
),
table2 as (
select id, value
from table1
lateral view explode(split(values, ',')) vals as value
),
table3 as (
select id, collect_set(value) as values
from table2
group by id
)
select concat_ws(values, ',') as values
from table3
1条答案
按热度按时间z9gpfhce1#
如果在最后一个表中不需要空字符串和额外的逗号,那么可以按逗号拆分字符串,分解结果数组,然后收集集合,例如。