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



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

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

  1. 在配置单元中创建一个表。

     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/';

最新更新