Concatenate other fields after Hive group by operation
Table tmp_test
An ios
B andriod
An andriod
Target data
An ios | andriod
B andriod
Sql: select uid,concat_ws ('|', collect_set (device)) from tmp_test group by uid
Collect_set is an aggregate function built into Hive that returns a collection of objects with deduplicated elements whose return type is array.