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
1,403 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

What are some of the famous visualization tools which can be integrated with Hadoop & Hive?

I have personally used two visualization tools ...READ MORE

answered May 1, 2018 in Big Data Hadoop by coldcode
• 2,080 points
1,276 views
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,210 points
2,625 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 5, 2019 in Big Data Hadoop by Omkar
• 69,210 points
2,369 views
0 votes
1 answer

Creating a Parquet or Avro file

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

answered Jan 22, 2019 in Big Data Hadoop by Omkar
• 69,210 points
548 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
• 11,380 points
8,920 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
• 11,380 points
1,594 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
80,079 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,390 points
3,401 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
• 65,870 points

edited May 15, 2019 by Gitika 1,329 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
7,110 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP