Ajay-Pandey
Databricks MVP

Hi @Harish K​ you can use the below query in spark SQL-

%sql
SELECT col1, array_join(collect_set(col2), ',') j
FROM tmp
GROUP BY col1

Ajay Kumar Pandey