title: Aggregations of aggregations are not allowed Bigquery
body: <p>I'm trying to query my google bigquery analytics table.
  The fields I'm interested in are nested.
  The structure I want to retrieve fits : Category > Subcategory > Subsubcategory.</p>
  
  <p>I tried to do the following:</p>
  
  <pre><code>select 
  event_param1.value.string_value AS category,
  event_param2.value.string_value AS action,
  ARRAY_AGG(DISTINCT event_param3.value.string_value) AS label
  FROM `analytics.events_20*` AS t,
  UNNEST(event_params) as event_param1,
  UNNEST(event_params) as event_param2,
  UNNEST(event_params) as event_param3
  where
  parse_date('%y%m%d', _table_suffix) between DATE_sub(current_date(), interval 30 day) and DATE_sub(current_date(), interval 1 day) AND
  event_param1.key = 'category' and
  event_param2.key = 'action' and
  event_param3.key = 'label'
  group by category, action
  order by category, action
  </code></pre>
  
  <p>But this returns one row with one category, one subcategory, and an array of all subsubcategories.</p>
  
  <p>I want to have one row with one category, all subcategories, all subsubcategories per subcategory.</p>
  
  <p>This is an example of what I get:</p>
  
  <pre><code>{
      "category": "Apple Watch",
      "action": "Apple Badge Clicked",
      "label": [
        "User Landing Page",
        "Attract",
        "Guest Landing Page",
        "Guest In Workout",
        "User In Workout"
      ]
    },
    {
      "category": "Apple Watch",
      "action": "CONNECTED",
      "label": [
        "User Landing Page",
        "Attract",
        "Guest Landing Page",
        "Guest In Workout",
        "User In Workout"
      ]
    }
  </code></pre>
  
  <p>And this is what I want:</p>
  
  <pre><code>{
      "category": "Apple Watch",
      "action": {
          "Apple Badge Clicked": {
              "label": [
                  "User Landing Page",
                  "Attract",
                  "Guest Landing Page",
                  "Guest In Workout",
                  "User In Workout"
              ]
          },
          "CONNECTED": {
              "label": [
                  "User Landing Page",
                  "Attract",
                  "Guest Landing Page",
                  "Guest In Workout",
                  "User In Workout"
              ]
          }
      }
  }
  </code></pre>
  
  <p>If I try an ARRAY_AGG inside another ARRAY_AGG, I get <code>Aggregations of aggregations are not allowed Bigquery</code>.
  I'm aware that what I am asking is not that simple but a similar solution would work too. </p>