I am trying to use collect_set in a hive query to group the columns on a group by condition. Each row is having spaces as delimiters instead of ',' or something. How to change the delimiter to ',' or any other delimiter in this case?
Thanks in advance.
Regards, Naga Vemprala
COLLECT_SET
returns an array, with which you can then concatenate the entries into a single comma-separated value using CONCAT_WS
:
select serial_num, concat_ws(",", collect_set(customer_lastName)) as concatenate_lastNames from External_Table group by serial_num
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With