title: Hive - partition by year
body: <p>I am partitioning by year in hive. I have created a script:</p>
  
  <pre><code>DROP TABLE movies_byYear;
  
  CREATE TABLE movies_byYear (title STRING, full_name STRING, ep_name STRING, type STRING, ep_num STRING, suspended BOOLEAN) PARTITIONED BY (year INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE;
  
  INSERT OVERWRITE TABLE movies_byYear PARTITION (year='2013') SELECT title, full_name, ep_name, type, ep_num, suspended FROM movies WHERE year='2013';
  </code></pre>
  
  <p>However, when using: <code>SELECT COUNT(*) FROM movies WHERE year='2013';</code></p>
  
  <p>I do not get all movies by year 2013 back, instead I get all movies back.</p>
  
  <p>Is it also possible to let hive decide where to partition?</p>
  
  <p>I really appreciate your answer!!!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>When adding <code>year</code> I get:</p>
  
  <pre><code>INSERT OVERWRITE TABLE movies_byYear PARTITION (year=2013) SELECT title, full_name, ep_name, type, ep_num, suspended, year FROM movies WHERE year=2013;
  
  FAILED: SemanticException [Error 10044]: Line 1:23 Cannot insert into target table because column number/types are different '2013': Table insclause-0 has 6 columns, but query has 7 columns.
  </code></pre>