Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
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.