<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Hive Dynamic partition issue in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hive-Dynamic-partition-issue/m-p/189640#M151733</link>
    <description>&lt;P&gt;I have 2 tables as below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE EXTERNAL TABLE IF NOT EXISTS TEMP_tab(id int,mytime STRING,age int)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION 'hdfs://xxx';

CREATE TABLE IF NOT EXISTS main_TAB(id int,age int)
PARTITIONED BY (mytime STRING)
STORED AS ORC
tblproperties ("orc.compress"="ZLIB");

FROM TEMP_TAB INSERT OVERWRITE TABLE main_TAB 
PARTITION (mytime) 
SELECT *,substr(mytime,0,10) as mytime;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but the strange thing is Insert does not work. It has following error message&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;Error: org.apache.spark.sql.AnalysisException: Cannot insert into table &lt;CODE&gt;m16&lt;/CODE&gt;.&lt;CODE&gt;main_TAB&lt;/CODE&gt; because the number of columns are different: need 2 columns, but query has 3 columns.; (state=,code=0)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have already set these 2 as well&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SET hive.exec.dynamic.partition = true &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;SET hive.exec.dynamic.partition.mode = nonstrict&lt;/P&gt;</description>
    <pubDate>Mon, 06 Nov 2017 15:03:55 GMT</pubDate>
    <dc:creator>learnsqoop</dc:creator>
    <dc:date>2017-11-06T15:03:55Z</dc:date>
  </channel>
</rss>

