title: CTAS with Dynamic Partition
body: <p>I want to change an existing table, that contains text format, into orc format. I was able to do it by: 
  (1) creating a table in orc format manually having the partitions and then, 
  (2) using the INSERT OVERWRITE statement to populate the table.</p>
  
  <p>I am trying to use CTAS (Create Table... AS Select...) statement for this. 
  Is there any way I can include the dynamic partitioning with CTAS statement? 
  So, if my text data set has multiple partitions (for example: year and month), can I point this in CTAS statement directly? </p>
  
  <p>The format might be something like this:</p>
  
  <pre><code>CREATE TABLE TEST_TABLE
  STORED AS ORC
  WITH PARTITION(year, month)
  LOCATION '/&lt;my_location&gt;'
  tblproperties ("orc.compress"="SNAPPY")
  AS SELECT * FROM &lt;existing_table&gt;;
  </code></pre>
  
  <p>Any idea please?</p>
  
  <p>Note: The reason I'm interested for CTAS statement is as: using this statement, I don't really need to point out each and every columns name. 
  But if I create an orc based table and then populate it manually, I had to indicate all the columns while creating the table. This is okay; but, not a good idea if my existing table contains a lot of columns.</p>