簡體   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