Support Questions

Find answers, ask questions, and share your expertise

Hive table Creation from ORC format file

avatar
New Contributor

I have a ORC storage file and I am creating External table in HIVE using the below query.

  1. CREATE EXTERNAL TABLE mytable
  2. (col1 bigint,col2 bigint) ROW FORMAT DELIMITED
  3. FIELDS TERMINATED BY ','
  4. STORED AS ORC
  5. location '<ORC File location';

The external table is getting loaded but when i am trying to query in HIVE. it is showing junk data. Can you please suggest what is the mistake in the query. Also , I am using the same delimeter for ORC storage and HIVE table creation.

2 REPLIES 2

avatar
@Sudha Chandrika

ORC is a Column Major storage format! You need not mention ROW FORMAT DELIMITED FIELDS TERMINATED BY statements.

Simply create your table as

CREATE EXTERNAL TABLE mytable
(
col1 bigint,
col2 bigint
) 
STORED AS ORC
location '<ORC File location';

From Question - I am using the same delimiter for ORC storage and HIVE table creation.

How are you creating ORC file?

avatar
@Sudha Chandrika

Did the answer help in the resolution of your query? Please close the thread by marking the answer as Accepted!