在hive Ubuntu中创建ORC文件表时它失败了.FAILED:语义分析出错:STORED AS子句中无法识别的文件格式:orc

时间:2016-09-28 09:25:01

标签: hive hiveql ubuntu-16.04

hive> create table orc_table (name string,img_loc string) stored as orc tblproperties("orc.compress"="none");

FAILED: Error in semantic analysis: Unrecognized file format in STORED AS clause: orc


hive> create table orc_table (name string,img_loc string) stored as orcfile tblproperties("orc.compress"="none");

FAILED: Error in semantic analysis: Unrecognized file format in STORED AS clause: orcfile


hive> create table orc_table(name string,img_loc string) stored as orcfile;

FAILED: Error in semantic analysis: Unrecognized file format in STORED AS clause: orcfile



hive> create table orc_table(name string,img_loc string) stored as orc;    
FAILED: Error in semantic analysis: Unrecognized file format in STORED AS clause: orc

2 个答案:

答案 0 :(得分:0)

这里加载非ORC文件,这就是发生此错误的原因。因此,最佳解决方案是首先使表加载数据并将此表插入orc表

CREATE TABLE data(value1 string, value2 string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '|';

终止于b" |"因为我正在使用PSV文件,您可以根据您的文件格式设置。

LOAD DATA INPATH '/user/hive/data.psv' INTO TABLE data;

create data2 stored as ORC tblproperties ("orc.compress" = "SNAPPY");

insert into data2 select * from data; 

答案 1 :(得分:0)

您需要确保您的HIVE版本大于0.11。 ORC是在0.11版本中引入的

ORC         -- (Note: Available in Hive 0.11.0 and later)

如何查看hive版本

$ hive --version
Hive 0.14.0.2.2.4.8-40