Created 08-24-2017 08:28 PM
Select name, city from people;
The above query results:
jon Atlanta
jon Newyork
snow LA
snow DC
But i want the result as a single row as follows:
jon Atlanta,Newyork
snow LA,DC
Created 08-24-2017 08:38 PM
You can use the collect_set UDAF function in hive.
select name, collect_set(city) from people group by name;
collect_Set will remove all duplicates.
If you need the duplicates then you must use "collect_list".
Created 08-24-2017 08:38 PM
You can use the collect_set UDAF function in hive.
select name, collect_set(city) from people group by name;
collect_Set will remove all duplicates.
If you need the duplicates then you must use "collect_list".
Created 08-24-2017 10:12 PM
Thank you..!!
It worked.