Created 05-31-2017 09:36 AM
How Can I load a sequence file to an external table.
Looking for a help
Created 06-01-2017 10:37 PM
Hi @Dinesh Das
You can do a CREATE EXTERNAL table as normal, but add the storage qualifier to it. For example:
create external table countries_ext_seq
LIKE countries_seq
STORED AS SEQUENCEFILE
LOCATION '/tmp/seqTest'
In the above example, I already have an existing hive table with the same columns and datatypes, so I use the lazy method by using the LIKE clause, but you can do the same with a full definition. I'm able to create this external table, point it to an existing sequence file stored in HDFS, and query with no problem.
As always, if you find this post useful, please "Accept" the answer.
Created 06-01-2017 10:37 PM
Hi @Dinesh Das
You can do a CREATE EXTERNAL table as normal, but add the storage qualifier to it. For example:
create external table countries_ext_seq
LIKE countries_seq
STORED AS SEQUENCEFILE
LOCATION '/tmp/seqTest'
In the above example, I already have an existing hive table with the same columns and datatypes, so I use the lazy method by using the LIKE clause, but you can do the same with a full definition. I'm able to create this external table, point it to an existing sequence file stored in HDFS, and query with no problem.
As always, if you find this post useful, please "Accept" the answer.
Created 06-02-2017 08:05 AM
You need to create external table then load data either from local or from HDFS.
CREATE EXTERNAL TABLE <table_name> (column1 <datatype>,column2 <datatype>,column3 <datatype>,...) ROW FORMAT DELIMITED STORED AS SEQUENCEFILE LOCATION '<location_path>'; Now Load data : LOAD DATA INPATH '<HDFS PATH>' INTO <table_name>;