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, 2019 in Big Data Hadoop by Richit
443 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, 2019 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
• 69,060 points
1,061 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, 2019 in Big Data Hadoop by Omkar
• 69,060 points
862 views
0 votes
1 answer

Creating a Parquet or Avro file

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

answered Jan 21, 2019 in Big Data Hadoop by Omkar
• 69,060 points
242 views
+1 vote
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,920 points
5,102 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,920 points
729 views
+1 vote
11 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
30,297 views
–1 vote
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,310 points
1,903 views
0 votes
1 answer

Can you please help with Hive Query to get FirstName, MiddleName, LastName and Suffix from FullName in Hive. Thank you

Hey, You can get first name, middle name, ...READ MORE

answered May 15, 2019 in Big Data Hadoop by Gitika
• 29,690 points

edited May 15, 2019 by Gitika 473 views
0 votes
1 answer

Read Parquet file using hdfs dfs -cat command

When you try to read a parquet ...READ MORE

answered May 24, 2019 in Big Data Hadoop by Calvin
2,409 views