title: Generic comparison method for two tables in BigQuery if tables contain STRUCT type
body: <p>I'm looking for a generic method to compare two tables in BigQuery, even if they have columns that are STRUCT type.</p>
  <p>It should work for any pair of tables, and ideally wouldn't involve writing a query that depends on that actual columns of the tables.  All I really need to know is if the tables are equal or not, but it would be a bonus if it could show me the difference between the rows that aren't the same.</p>
  <p>So something like (in pseudo code)</p>
  <p><code>sizeOf( TABLE A EXCEPT TABLE B ) == 0</code></p>
  <p>or</p>
  <p><code>Hash(TABLE A) == HASH(TABLE B)</code></p>
  <p>Would be fine.</p>
  <p>I tried using this:</p>
  <pre><code>(   SELECT * FROM table1
      EXCEPT DISTINCT
      SELECT * FROM table2)  
  UNION ALL
  (   SELECT * FROM table2
      EXCEPT DISTINCT
      SELECT * FROM table1) 
  </code></pre>
  <p>But I got this error.</p>
  <pre><code>Column 1 in EXCEPT ALL has type that does not support set operation comparisons: STRUCT at [3:5]
  </code></pre>
  <p>Does anyone know of a way to get around this?</p>
  <h1>EDIT</h1>
  <p>Should have mentioned before, but I need this to work regardless of the ordering of the rows of the table.</p>