且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Hive错误:parseexception缺少EOF

更新时间:2022-10-15 11:54:54

尝试在下面的tblproperties前放置LOCATION,为我工作。

  CREATE TABLE default.testtbl(int1 INT,string1 STRING)
存储为orc
LOCATION/ user / hive / test_table
tblproperties(orc.compress=NONE);

看起来即使是Programming Hive一书中的示例SQL也得到了错误的命令。请参考create table命令的官方定义:

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


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!

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