Sushil Ks
Sushil Ks

Reputation: 403

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

I have created a managed hive table which is stored as ORC and when loading .txt files its working fine, however am not able to load an ORC file into that table. Is there anything to do with delimiters? or am i missing something?

Upvotes: 2

Views: 6849

Answers (2)

Simon PII
Simon PII

Reputation: 501

After several tries, here is the solution that works for me :

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

Upvotes: 0

Tushar Singhal
Tushar Singhal

Reputation: 49

Below code is working for me, while loading ORC files present in HDFS into a hive table.

  1. Create a table in 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 to the table.

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

Upvotes: 2

Related Questions