1. 程式人生 > >collect_set、collect_list 、concat_ws (多行合併)

collect_set、collect_list 、concat_ws (多行合併)

collect_set去除重複元素;collect_list不去除重複元素

+------+-----------------------------------+------------------------------------+
|gender|concat_ws(,, collect_set(children))|concat_ws(,, collect_list(children))|
+------+-----------------------------------+------------------------------------+
|female|                             no,yes|                    no,yes,no,no,yes|
|  male|                             no,yes|                    no,yes,no,yes,no|
+------+-----------------------------------+------------------------------------+