Hive error: parseexception missing EOF

lex picture lex · Mar 17, 2014 · Viewed 90.7k times · Source

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!

Answer

Haiying Wang picture Haiying Wang · Jun 23, 2015

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