-- 将字段去重并合并 select concat_ws(',',collect_set(cast(id as string))) as wm from ( select 1 as id union all select 1 as id union all select 1 as id union all select 2 as id union all select 3 as id ) t1 ;