Parquet & Avro File hadling with HIVE

0 votes
How to deal with Parquet & Avro File Format in HIVE?
Do we need to add or download dependencies for the same, if Yes what are the steps?
Jul 25 in Big Data Hadoop by Richit
35 views

1 answer to this question.

0 votes

For avro you can follow the format as shown below.

CREATE TABLE table_name

PARTITIONED BY (t string, y string, m string, d string, h string, hh string)

ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'

STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'

OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'

TBLPROPERTIES (

'avro.schema.url'='hdfs://location/schema/schema.avsc')

location "hdfs:///location/data;

and load the data like


/location/data/y=2016/m=02/d=03/h=03/hh=12/data.avro 

/location/data/y=2016/m=02/d=03/h=03/hh=13/data2.avro

in that way you will be able to load the data with the following statement. All the jars should be already present in hive if not then avro-json-1.0-SNAPSHOT.jar needs to be added.

And the solution for parquet is to create dynamically a table from avro, and then create a new table of parquet format from the avro one.

there is the source code from Hive, which should help you.

CREATE TABLE avro_test ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe' STORED AS AVRO TBLPROPERTIES ('avro.schema.url'='myHost/myAvroSchema.avsc');


CREATE EXTERNAL TABLE parquet_test LIKE avro_test STORED AS PARQUET LOCATION 'hdfs://myParquetFilesPath';
answered Jul 25 by Tarun

Related Questions In Big Data Hadoop

0 votes
1 answer
0 votes
1 answer

How to create a Hive table with a sequence file?

In Hive we can create a sequence ...READ MORE

answered Dec 17, 2018 in Big Data Hadoop by Omkar
• 67,620 points
485 views
–1 vote
1 answer

Create Hive table with bucketing and ORC file format

create table hive_dml (emp_id int, first_name string, last_name ...READ MORE

answered Jan 4 in Big Data Hadoop by Omkar
• 67,620 points
278 views
0 votes
1 answer

Creating a Parquet or Avro file

In hadoop, we do not create different ...READ MORE

answered Jan 21 in Big Data Hadoop by Omkar
• 67,620 points
124 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,690 points
3,023 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,690 points
337 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
14,919 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
1,109 views
0 votes
1 answer
0 votes
1 answer