Search This Blog

Step by step guide to create an ORC table in Apache Hive

In this article , We will learn how to work create hive table with  ORC data format.

1)

Create a normal table, You can check this article to create a normal table in Hive.

2)
Create an ORC table, Use stored as orc to create an ORC table. .

create table employee_orc(name string,salary int,deptno int,DOJ date)
row format delimited fields terminated by ',' 

STORED AS orc ;





3)

Load data from normal table to ORC table. Implicitely data will be converted into ORC data format.

INSERT INTO TABLE employee_orc SELECT * FROM employee;






4)

 Create an ORC table with tblproperties. You can specify custome values to ORC format properties.
The code below changes ORC compression to NONE, It's default value  isZLIB.

create table employee_orc(name string,salary int,deptno int,DOJ date)
row format delimited fields terminated by ',' 

STORED AS orc tblproperties ("orc.compress"="NONE");





No comments:

Post a Comment