title: RANK or ROW_NUMBER in BigQuery over a large dataset
body: <p>I need to add row numbers to a large (ca. billion rows) dataset in BigQuery. When I try:</p>
  
  <pre><code>SELECT 
    *
    ROW_NUMBER() OVER (ORDER BY d_arf DESC) plarf 
  FROM [trigram.trigrams8]
  </code></pre>
  
  <p>I get "Resources exceeded during query execution.", because an analytic/window function needs to fit in one node.</p>
  
  <p>How can I add row numbers to a large dataset in BigQuery?</p>