Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hive error: parseexception missing EOF

I am not sure what I am doing wrong here:

hive> CREATE TABLE default.testtbl(int1 INT,string1 STRING)  
      stored as orc 
      tblproperties ("orc.compress"="NONE") 
      LOCATION "/user/hive/test_table";

      FAILED: ParseException line 1:107 missing EOF at 'LOCATION' near ')'

while the following query works perfectly fine:

hive>  CREATE TABLE default.testtbl(int1 INT,string1 STRING)  
       stored as orc 
       tblproperties ("orc.compress"="NONE");
       OK
       Time taken: 0.106 seconds

Am I missing something here. Any pointers will help. Thanks!

like image 756
lex Avatar asked Mar 17 '14 19:03

lex


1 Answers

Try put the "LOCATION" in front of "tblproperties" like below, worked for me.

CREATE TABLE default.testtbl(int1 INT,string1 STRING)  
  stored as orc 
  LOCATION "/user/hive/test_table"
  tblproperties ("orc.compress"="NONE");

It seems even the sample SQL from book "Programming Hive" got the order wrong. Please reference to the official definition of create table command:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable

like image 175
Haiying Wang Avatar answered Sep 21 '22 10:09

Haiying Wang