<?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 Re: Hive Script Unable to Insert int target in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198026#M160077</link>
    <description>&lt;P&gt;rtrivedi&lt;/P&gt;&lt;P&gt;I have modified the script to add the following line of code:&lt;/P&gt;&lt;P&gt;TBLPROPERTIES ("skip.header.line.count" = "1");&lt;/P&gt;&lt;P&gt;The script now looks like the following:&lt;/P&gt;&lt;PRE&gt;DROP TABLE IF EXISTS HiveSampleIn; 
CREATE EXTERNAL TABLE HiveSampleIn 
(
 anonid int,
 eprofileclass int,
 fueltypes STRING,
 acorn_category int,
 acorn_group STRING,
 acorn_type int,
 nuts4 STRING,
 lacode STRING,
 nuts1 STRING,
 gspgroup STRING,
 ldz STRING,
 gas_elec STRING,
 gas_tout STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/samplein/'; 
TBLPROPERTIES ("skip.header.line.count" = "1");
DROP TABLE IF EXISTS HiveSampleOut; 
CREATE EXTERNAL TABLE HiveSampleOut 
(
acorn_category int,
acorn_categorycount int )
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/sampleout/';
INSERT OVERWRITE TABLE HiveSampleOut
Select 
   acorn_category,
   count(*) as acorn_categorycount 
FROM HiveSampleIn Group by acorn_category;&lt;/PRE&gt;&lt;P&gt;However, I keep on getting the following error:&lt;/P&gt;&lt;PRE&gt;FAILED: ParseException line 2:0 cannot recognize input near 'TBLPROPERTIES' '(' '"skip.header.line.count"'
18/01/31 11:28:20 [main]: ERROR ql.Driver: FAILED: ParseException line 2:0 cannot recognize input near 'TBLPROPERTIES' '(' '"skip.header.line.count"'
org.apache.hadoop.hive.ql.parse.ParseException: line 2:0 cannot recognize input near 'TBLPROPERTIES' '(' '"skip.header.line.count"'&lt;/PRE&gt;&lt;P&gt;Your help with this last error will complete all that I need to know to fix this issue.&lt;/P&gt;&lt;P&gt;Much appreciated&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 19:33:36 GMT</pubDate>
    <dc:creator>barlow</dc:creator>
    <dc:date>2018-01-31T19:33:36Z</dc:date>
    <item>
      <title>Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198021#M160072</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;Can some let me know why I'm getting the error following error:&lt;/P&gt;&lt;PRE&gt;FAILED: SemanticException [Error 10044]: Line 3:23 Cannot insert into target table because column number/types are different 'HiveSampleOut': Table insclause-0 has 1 columns, but query has 2 columns.
18/01/28 20:21:39 [main]: ERROR ql.Driver: FAILED: SemanticException [Error 10044]: Line 3:23 Cannot insert into target table because column number/types are different 'HiveSampleOut': Table insclause-0 has 1 columns, but query has 2 columns.&lt;/PRE&gt;&lt;P&gt;I have the following Hive script&lt;/P&gt;&lt;PRE&gt;DROP TABLE IF EXISTS HiveSampleIn; 
CREATE EXTERNAL TABLE HiveSampleIn 
(
 anonid int,
 eprofileclass int,
 fueltypes STRING,
 acorn_category int,
 acorn_group STRING,
 acorn_type int,
 nuts4 STRING,
 lacode STRING,
 nuts1 STRING,
 gspgroup STRING,
 ldz STRING,
 gas_elec STRING,
 gas_tout STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/samplein/'; 
DROP TABLE IF EXISTS HiveSampleOut; 
CREATE EXTERNAL TABLE HiveSampleOut 
(   
    acorn_category int
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/sampleout/';
INSERT OVERWRITE TABLE HiveSampleOut
Select 
   acorn_category,
   count(*) as acorn_categorycount 
FROM HiveSampleIn Group by acorn_category&lt;/PRE&gt;&lt;P&gt;Any help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Carlton&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 04:34:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198021#M160072</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-01-29T04:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198022#M160073</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/63166/carlton.html" nodeid="63166"&gt;@Carlton Patterson&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;HiveSampleOut has only 1 field acorn_category and you are trying to insert 2 fields into this table acorn_category and acorn_categorycount. Hence, the error.&lt;/P&gt;&lt;P&gt;Define the table with 2 fields .&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 14:53:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198022#M160073</guid>
      <dc:creator>rtrivedi</dc:creator>
      <dc:date>2018-01-30T14:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198023#M160074</link>
      <description>&lt;P&gt;Hi rtrivedi&lt;/P&gt;&lt;P&gt;Thanks for getting in touch. Im very new to Hive, tbh, I took the script from the following link&lt;/P&gt;&lt;P&gt;&lt;A href="https://bigdata.ukdataservice.ac.uk/media/604332/hiveql-queries.pdf#page5" target="_blank"&gt;https://bigdata.ukdataservice.ac.uk/media/604332/hiveql-queries.pdf#page5&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the link, the author suggests using the following line of code to fix the problem&lt;/P&gt;&lt;P&gt;TBLPROPERTIES ("skip.header.line.count" = "1"); &lt;/P&gt;&lt;P&gt;But I can't get the code to work with the Hive script.&lt;/P&gt;&lt;P&gt;Therefore, if you could show me how implement the code or let me know how to define a table with 2 fields as you suggested that would be very much appreciated.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Carlton&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 19:06:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198023#M160074</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-01-30T19:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198024#M160075</link>
      <description>&lt;P&gt;Create your table as :&lt;/P&gt;&lt;P&gt;       CREATE EXTERNAL TABLE HiveSampleOut (&lt;/P&gt;&lt;P&gt;         acorn_category int,&lt;/P&gt;&lt;P&gt;         acorn_categorycount int )&lt;/P&gt;&lt;P&gt;        ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/sampleout/';&lt;/P&gt;&lt;P&gt;Or directly create table on the fly while inserting data  like: &lt;/P&gt;&lt;P&gt;Create table HiveSampleOut As Select acorn_category, count(*)as acorn_categorycount FROM HiveSampleInGroupby acorn_category ;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 16:09:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198024#M160075</guid>
      <dc:creator>rtrivedi</dc:creator>
      <dc:date>2018-01-31T16:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198025#M160076</link>
      <description>&lt;P&gt;rtrivedi&lt;/P&gt;&lt;P&gt;That worked perfectly thanks so much..&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 19:23:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198025#M160076</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-01-31T19:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198026#M160077</link>
      <description>&lt;P&gt;rtrivedi&lt;/P&gt;&lt;P&gt;I have modified the script to add the following line of code:&lt;/P&gt;&lt;P&gt;TBLPROPERTIES ("skip.header.line.count" = "1");&lt;/P&gt;&lt;P&gt;The script now looks like the following:&lt;/P&gt;&lt;PRE&gt;DROP TABLE IF EXISTS HiveSampleIn; 
CREATE EXTERNAL TABLE HiveSampleIn 
(
 anonid int,
 eprofileclass int,
 fueltypes STRING,
 acorn_category int,
 acorn_group STRING,
 acorn_type int,
 nuts4 STRING,
 lacode STRING,
 nuts1 STRING,
 gspgroup STRING,
 ldz STRING,
 gas_elec STRING,
 gas_tout STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/samplein/'; 
TBLPROPERTIES ("skip.header.line.count" = "1");
DROP TABLE IF EXISTS HiveSampleOut; 
CREATE EXTERNAL TABLE HiveSampleOut 
(
acorn_category int,
acorn_categorycount int )
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/sampleout/';
INSERT OVERWRITE TABLE HiveSampleOut
Select 
   acorn_category,
   count(*) as acorn_categorycount 
FROM HiveSampleIn Group by acorn_category;&lt;/PRE&gt;&lt;P&gt;However, I keep on getting the following error:&lt;/P&gt;&lt;PRE&gt;FAILED: ParseException line 2:0 cannot recognize input near 'TBLPROPERTIES' '(' '"skip.header.line.count"'
18/01/31 11:28:20 [main]: ERROR ql.Driver: FAILED: ParseException line 2:0 cannot recognize input near 'TBLPROPERTIES' '(' '"skip.header.line.count"'
org.apache.hadoop.hive.ql.parse.ParseException: line 2:0 cannot recognize input near 'TBLPROPERTIES' '(' '"skip.header.line.count"'&lt;/PRE&gt;&lt;P&gt;Your help with this last error will complete all that I need to know to fix this issue.&lt;/P&gt;&lt;P&gt;Much appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 19:33:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198026#M160077</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-01-31T19:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198027#M160078</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/63166/carlton.html" nodeid="63166"&gt;@Carlton Patterson&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;There is an extra semicolon before TBLPROPERTIES , removing it will solve your problem. Use below script:&lt;/P&gt;&lt;P&gt;DROP TABLE IF EXISTS HiveSampleIn; 
CREATE EXTERNAL TABLE HiveSampleIn 
(
 anonid int,
 eprofileclass int,
 fueltypes STRING,
 acorn_category int,
 acorn_group STRING,
 acorn_type int,
 nuts4 STRING,
 lacode STRING,
 nuts1 STRING,
 gspgroup STRING,
 ldz STRING,
 gas_elec STRING,
 gas_tout STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/samplein/' 
TBLPROPERTIES ("skip.header.line.count" = "1"); &lt;/P&gt;&lt;P&gt;DROP TABLE IF EXISTS HiveSampleOut; 
CREATE EXTERNAL TABLE HiveSampleOut 
(
acorn_category int,
acorn_categorycount int )
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/sampleout/'; &lt;/P&gt;&lt;P&gt;INSERT OVERWRITE TABLE HiveSampleOut
Select 
   acorn_category,
   count(*) as acorn_categorycount 
FROM HiveSampleIn Group by acorn_category;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:15:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198027#M160078</guid>
      <dc:creator>rtrivedi</dc:creator>
      <dc:date>2018-02-01T14:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198028#M160079</link>
      <description>&lt;P&gt;Hi rtrivedi,&lt;/P&gt;&lt;P&gt;I'm about to test this out. &lt;/P&gt;&lt;P&gt;I will let you know how I get on.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 18:59:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198028#M160079</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-01T18:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198029#M160080</link>
      <description>&lt;P&gt;Hi rtrivedi,&lt;/P&gt;&lt;P&gt;The fix you provided worked perfectly. Would it be possible to include the column headings in the output? At the moment, the output looks like the following:&lt;/P&gt;&lt;PRE&gt;\N,1
0,9
1,5159
2,694
3,4540
4,1975
5,2207
6,36&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Feb 2018 23:03:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198029#M160080</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-01T23:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198030#M160081</link>
      <description>&lt;P&gt;Cool ! Please accept the answer.&lt;/P&gt;&lt;P&gt;You can execute below command before your select query to get column headers.&lt;/P&gt;&lt;PRE&gt;&amp;lt;code&amp;gt;set hive.cli.print.header=true;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Feb 2018 23:10:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198030#M160081</guid>
      <dc:creator>rtrivedi</dc:creator>
      <dc:date>2018-02-01T23:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198031#M160082</link>
      <description>&lt;P&gt;Hi rtrivedi&lt;/P&gt;&lt;P&gt;I added set hive.cli.print.header=true;&lt;/P&gt;&lt;P&gt;However, I getting the following error:&lt;/P&gt;&lt;PRE&gt;&lt;SMALL&gt;org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 2:0 cannot recognize input near 'set' 'hive' '.' in statement&lt;/SMALL&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 00:22:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198031#M160082</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-02T00:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198032#M160083</link>
      <description>&lt;P&gt;Hi rtrivedi,&lt;/P&gt;&lt;P&gt;I added the additional code you suggested, however I'm getting the following error:&lt;/P&gt;&lt;PRE&gt;&lt;SMALL&gt;org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 2:0 cannot recognize input near 'set' 'hive' '.' in statement&lt;/SMALL&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 00:23:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198032#M160083</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-02T00:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198033#M160084</link>
      <description>&lt;P&gt;Hi rtrivedi,&lt;/P&gt;&lt;P&gt;I added the additional code as suggested, but I get the following error:&lt;/P&gt;&lt;PRE&gt;&lt;SMALL&gt;org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 2:0 cannot recognize input near 'set' 'hive' '.' in statement&lt;/SMALL&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 00:25:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198033#M160084</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-02T00:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198034#M160085</link>
      <description>&lt;P&gt;Hi rtrivedi,&lt;/P&gt;&lt;P&gt;I added the additional code as suggested, but I get the following error:&lt;/P&gt;&lt;PRE&gt;&lt;SMALL&gt;org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 2:0 cannot recognize input near 'set' 'hive' '.' in statement&lt;/SMALL&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 00:25:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198034#M160085</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-02T00:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Script Unable to Insert int target</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198035#M160086</link>
      <description>&lt;P&gt;Hi rtrivedi,&lt;/P&gt;&lt;P&gt;I added the additional code as suggested, but I get the following error:&lt;/P&gt;&lt;PRE&gt;&lt;SMALL&gt;org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 2:0 cannot recognize input near 'set' 'hive' '.' in statement&lt;/SMALL&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 00:26:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Script-Unable-to-Insert-int-target/m-p/198035#M160086</guid>
      <dc:creator>barlow</dc:creator>
      <dc:date>2018-02-02T00:26:09Z</dc:date>
    </item>
  </channel>
</rss>

