SQL on Spark: How do I get all values of DISTINCT?

Viewed 24007

So, assume I have the following table:

Name | Color
------------------------------
John | Blue
Greg | Red
John | Yellow
Greg | Red
Greg | Blue

I would like to get a table of the distinct colors for each name - how many and their values. Meaning, something like this:

Name | Distinct | Values
--------------------------------------
John |   2      | Blue, Yellow
Greg |   2      | Red, Blue

Any ideas how to do so?

2 Answers
Related