title: HiveQL UNION ALL
body: <p>I have table_A:</p>
  
  <pre><code>id var1 var2
  1   a    b
  2   c    d
  </code></pre>
  
  <p>Table_B:</p>
  
  <pre><code>id var1 var2  
  3   e    f
  4   g    h
  </code></pre>
  
  <p>All I want is table, combined:</p>
  
  <pre><code>id var1 var2
  1   a    b
  2   c    d
  3   e    f
  4   g    h 
  </code></pre>
  
  <p>This is my .hql:</p>
  
  <pre><code>CREATE TABLE combined AS
  SELECT all.id, all.var1, all.var2
  FROM (
    SELECT a.id, a.var1, a.var2  
    FROM table_A a  
    UNION ALL  
    SELECT b.id, b.var1, b.var2  
    FROM table_B b
  ) all;
  </code></pre>
  
  <p>I'm coding straight from page 112 of Programming Hive by Edward Capriolo, et al.</p>
  
  <p>The error I get, no matter what ostensibly reasonable variation of the above that I try, is</p>
  
  <blockquote>
    <p><code>cannot recognize input near '.' 'id' ',' in select expression.</code></p>
  </blockquote>
  
  <p>I have tried using <code>AS</code> between the table name and the alias, asterisks since I want everything from both tables. Same error. I've tried other things and gotten other errors... All I want to do is <code>UNION</code> two tables. (I've tried <code>UNION</code> instead of <code>UNION ALL</code> — same error).</p>