title: Export BigQuery temporary table into multiple files based on value in column
body: <p>I have a following problem.
  Basing on query like this:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT lp_id, MOD(ABS(FARM_FINGERPRINT(lp_id)), 10) AS bucket FROM dataset.table
  </code></pre>
  <p>I am doing the query and saving the result as csv in Google Storage.</p>
  <pre class="lang-golang prettyprint-override"><code>// defined in scope:
  //   ctx          context.Context
  //   bucket       string
  //   folderName   string
  //   queryString  string
  
  query := bqClient.Query(queryString)
  job, err := query.Run(ctx)
  conf, err := job.Config()
  table := conf.(*bigquery.QueryConfig).Dst
  
  gcsURI := fmt.Sprintf(&quot;gs://%s/%s/*.%s&quot;, bucket, folderName, &quot;csv&quot;)
  gcsRef := bigquery.NewGCSReference(gcsURI)
  gcsRef.FieldDelimiter = &quot;,&quot;
  
  extractor := table.ExtractTo(gcsRef)
  
  // run job...
  </code></pre>
  <p>And, what I want to do is to split the result into multiple files basing on the bucket the user is (like users from bucket n into file <code>{{ n_filename }}</code>) in one job, to avoid increasing costs for data processing.
  Is it possible?</p>
  <p>Thanks for your help.</p>