title: Deduplicate rows in a BigQuery partition
body: <p>I have a table with many duplicated rows - but I only want to deduplicate rows one partition at a time.</p>
  
  <p>How can I do this?</p>
  
  <p>As an example, you can start with a table partitioned by date and filled with random integers from 1 to 5:</p>
  
  <pre><code>CREATE OR REPLACE TABLE `temp.many_random`
  PARTITION BY d
  AS 
  SELECT DATE('2018-10-01') d, fhoffa.x.random_int(0,5) random_int
  FROM UNNEST(GENERATE_ARRAY(1, 100))
  UNION ALL
  SELECT CURRENT_DATE() d, fhoffa.x.random_int(0,5) random_int
  FROM UNNEST(GENERATE_ARRAY(1, 100))
  </code></pre>