title: Insert data listing columns with partitioning field in Hive
body: <p>First of all let's setup a test environment:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS source_table (
    `col1` TIMESTAMP,
    `col2` STRING
  );
  
  CREATE TABLE IF NOT EXISTS dest_table (
    `col1` TIMESTAMP,
    `col2` STRING,
    `col3` STRING
  )
  PARTITIONED BY (day STRING)
  STORED AS AVRO;
  
  INSERT INTO TABLE source_table VALUES ('2018-03-21 17:08:04.401', 'test1'), ('2018-03-22 12:02:04.222', 'test2'), ('2018-03-22 07:21:04.111', 'test3');
  </code></pre>
  
  <p>How could I list the column names during insertion and put the partition value dynamically? The following command doesn't work:</p>
  
  <pre><code>INSERT INTO TABLE dest_table(col1, col2) PARTITION(day) SELECT col1, col2, date_format(col1, 'yyyy-MM-dd') FROM source_table;
  </code></pre>
  
  <p>By the way, without listing the columns of <code>dest_table</code> inside the <code>INSERT INTO</code> command, having two tables with the same columns number, everything works fine. What if my <code>dest_table</code> has more fields than the <code>source_table</code>?</p>
  
  <p>Thank you for helping me.</p>
  
  <p><strong>P.S.</strong></p>
  
  <p>Ok, if I hardcode <code>NULL</code> this works. I leave the question opened because there might be better ways to achieve that.</p>
  
  <pre><code>INSERT INTO TABLE dest_table PARTITION(day) SELECT col1, col2, NULL, date_format(col1, 'yyyy-MM-dd') FROM source_table;
  </code></pre>
  
  <p>Anyway, this method is strictly bounded with columns order? In a real-life scenario, how could I handle lots of columns specifying a mapping, to avoid mistakes?</p>