Search This Blog

How to create Hive table for sequece file format data ?

In this article we will learn How to create Hive table for sequence file format data. We  need to use stored as SequenceFile to create a hive table for sequence file format data.


1) Create  hive table without location.

We can create hive table for sequence file data without location.  And we can load data into that table later.

Command :

create table employee_seq(name string,salary int,deptno int,DOJ date)  row format delimited fields terminated by ',' stored as SequenceFile ;



2) Load data into hive table .

We can use normal insert query to load data into sequence file format table. Data will be converted into sequence file format while loading the data.

 insert into table employee_seq select * from employee;



3) Create hive table with location

We can  also create hive table for sequence file data  with location. Specified location should have sequence file format data.

Command :

create table employee_seq(name string,salary int,deptno int,DOJ date)  row format delimited fields terminated by ',' 
stored as SequenceFile location '/data/in/employee_seq' ;