Q:

sql query for creating map of array in aws athena (presto)

I have a table in aws athena with the following columns
Company name  Employee Name   Salary
------------------------------------
 Apple       | John         | 50
 Apple       | Dima         | 100
 Microsoft   | Bart         | 75
 Google      | Harry        | 90
 Google      | Noah         | 80

and I want to generate by a single query the following table preferably using map of arrays
Company name  Employee Data
------------------------------------
 Apple       | [John,50],[Dima,100]
 Microsoft   | [Bart,75]
 Google      | [Harry,90],[Noah,80]

Any idea on how it can be done?

A:

There is currently no formal group concat function in PrestoDB.  But we can come close:
SELECT
    CompanyName,
    array_join(array_agg('[' || EmployeeName || ',' || Salary || ']'), ',', '') AS EmployeeData
FROM yourTable
GROUP BY
    CompanyName;

