繁体   English   中英

如何将外部创建的 ORC 文件加载到存储为 ORC 的 HIVE 表中?

[英]How to load an ORC file created externally into HIVE Table stored as ORC?

我创建了一个托管配置单元表,该表存储为 ORC,并且在加载 .txt 文件时它工作正常,但是无法将 ORC 文件加载到该表中。 与定界符有什么关系吗? 还是我错过了什么?

下面的代码对我有用,同时将 HDFS 中存在的 ORC 文件加载到配置单元表中。

  1. 在 hive 中创建一个表。

     create table MyDB.TEST ( Col1 String, Col2 String, Col3 String, Col4 String) STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
  2. 将数据加载到表中。

     LOAD DATA INPATH '/hdfs/dir/folder/to/orc/files/' INTO TABLE MyDB.TEST;

经过多次尝试,以下是对我有用的解决方案:

create table MyDB.TEST (
Col1 String,
Col2 String,
Col3 String,
Col4 String)
STORED AS ORC
LOCATION 'hdfs://hdfs/dir/folder/to/orc/files/';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM