title: Impala/SQL: group by - aggregate a field by creating a list of all values
body: <p>I have a table below:</p>
  
  <pre><code>id  |  animal  |  team
  -------------------------
   1  |  dog     |  A
   2  |  cat     |  A
   3  |  cow     |  A
   4  |  bird    |  B
   5  |  rat     |  B
   6  |  goat    |  C
  </code></pre>
  
  <p>I want to group by team, and aggregate the animals in a team to a list. i.e. the output should look like:</p>
  
  <pre><code>team  |  animal_list
  --------------------------
   A    | [dog, cat, cow]
   B    | [bird, rat]
   C    | [goat]
  </code></pre>
  
  <p>Can this be achieved by Impala/SQL query?</p>