title: Using ARRAY_AGG() with all null values in input
body: <p>I want to select distinct values of columns for each user in my table (in Google BigQuery). I've thought about using <code>ARRAY_AGG()</code> like:</p>
  
  <pre><code>SELECT user_id, ARRAY_AGG(DISTINCT field1) AS f1, ARRAY_AGG(DISTINCT field2) AS f2
  FROM t GROUP BY user_id
  </code></pre>
  
  <p>But because for some <code>user_id</code>s all values in <code>field1</code> or <code>field2</code> are null, I get this error message: <code>Array 'f1' cannot have a null element</code></p>
  
  <p>I wonder if there is a workaround to avoid this error or maybe a different way to achieve the result without using <code>ARRAY_AGG()</code></p>