title: Get TableSchema from BigQuery result PCollection<TableRow>
body: <p>When I run a query in BigQuery Web UI, the results are displayed in a table where both name and type of each field are known (even when a field is a result of COUNT(), AVG(), ... operation, type of field is known, of course). 
  The results can be then directly exported as a table/json/csv.</p>
  
  <p>My question is, when I retrieve query results in my java project, e.g. with a query:</p>
  
  <pre><code>String query =  "SELECT nationality, COUNT(DISTINCT personID) AS population 
                   FROM Dataset.Table 
                   GROUP BY nationality";
  
  PCollection&lt;TableRow&gt; result = p.apply(BigQueryIO.Read.fromQuery(query));
  </code></pre>
  
  <p>... is it possible to obtain the schema of TableRow in <code>result</code> PCollection, without explicitly defining it? 
  I think it must be possible, since it's possible with the same query when using BigQuery Web UI.
  But I can't figure out how to do it ...</p>
  
  <pre><code>TableSchema schema =  // function of PCollection&lt;TableRow&gt; result ?
  
  result.apply(BigQueryIO.Write
                  .named("Write Results Table")
                  .to(getTableReference(tableName))
                  .withSchema(schema));
  </code></pre>
  
  <p>That way query results could be always automatically exported/saved into a new table (only the table name then needs to be explicitly provided).</p>
  
  <p>Any ideas? Any help would be appreciated :)</p>