表tmp_test
a ios
b andriod
a andriod
目標數據
a ios|andriod
b andriod
sql: select uid,concat_ws('|', collect_set(device)) from tmp_test group by uid;
collect_set 是 Hive 內置的一個聚合函數, 它返回一個消除了重複元素的對象集合, 其返回值類型是 array 。
表tmp_test
a ios
b andriod
a andriod
目標數據
a ios|andriod
b andriod
sql: select uid,concat_ws('|', collect_set(device)) from tmp_test group by uid;
collect_set 是 Hive 內置的一個聚合函數, 它返回一個消除了重複元素的對象集合, 其返回值類型是 array 。