Complete Hive Tutorial for Beginners

by | Jul 30, 2019 | Big Data

10 Min Read. |

High-volume and high-velocity data is the norm right now. This variety of data is a significant part of big data, and it is increasing as time passes.

It is predicted that by the year 2021, there will be 7.2 million data centres around the world that can store 1327 EB of data.

The figure is an eightfold increase from 2015. You need tools that can process this data. One such tool is the Apache Hive.

Hive is a tool within the Hadoop ecosystem, and Hive tutorials have become an essential component of any big data course. 


Hive Source – Wikipedia

Traditional database systems are not equipped to handle the amount of data generated by big data applications. Hadoop was developed to bridge this gap.

It is a framework that solves challenges in processing big data. Hadoop consists of two modules – MapReduce and HDFS. It also contains various tools that aid the Hadoop modules. Hive is one such tool. 

Are you curious? Would you like to know what is Hive? What is Hive architecture and why should you learn Hive? The rest of the post answers these crucial questions.  

What is Hive?

Hive is a data warehouse system that is built on top of Hadoop. It can summarise data, and run queries and analysis on large data sets.

Hive is built on top of the Hadoop Distributed File System. Most of the data from real-life applications are unstructured. Hive brings structure to the data. You can even perform SQL-like queries on the data.

As your Hive tutorial will tell you, it was initially developed by the Facebook data infrastructure team. Apache took over the project from Facebook and developed it further.

They also made it open-source. Facebook still uses Hive to store and process data. 

Facebook’s Hive-Hadoop cluster loads 15TB of raw data daily and stores over 2 PB of data.

Hive also supports a query language called HiveQL. It is very similar to SQL to bring the functionalities of SQL to Hadoop.

HiveQL translates the SQL-like queries into MapReduce jobs that can then be used on Hadoop.


HiveQL Source Pixabay

You need to keep in mind during your Hive tutorial that it is not a real-time application. It works best on batch jobs. You cannot use it only append-only data such as for weblogs. 

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 23rd Jan, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

The Hive queries are executed on the Hadoop database, unlike SQL which is executed on traditional databases. However, you can use ODBC or JDBC to integrate Hive architecture with traditional data technologies. This makes Hive a true all-rounder.

Here is a short video to help you get a better understanding of what is Hive.


Characteristics of Hive

Hive has gained its popularity due to its many features. To fully understand Hive, your Hive tutorial needs to cover these features or characteristics. Here are some of the most important ones.

(i) The execution of a Hive query is like a series of MapReduce jobs that are generated automatically. 

(ii) Hive is similar to SQL in that it queries and handles structured data. It structures the unstructured data before querying it.

(iii) The warehouse generates the tables and databases before adding the data to them. 

(iv) While executing a query, Hive uses the partition and bucket concept. It uses the directory structures to do this. It enables faster retrieval of data.

(v) You can create user-defined functions to perform certain tasks such as filtering, data cleansing. By doing so, you can optimise the MapReduce functions.

MapReduce, by itself, cannot create UDFs that execute queries in a manner that improves the performance. It can only do so with the help of Hive. 

(vi) The query language of Hive, Hive QL or HQL, is very similar to SQL. If you are well-versed in SQL, you will have no trouble learning HQL. The command-line interface lets you use HQL to communicate with the database. 

(vii) Since HQL is much simpler to learn and execute, it acts as a separation between you and the complexities of the MapReduce module.

If you were put off using MapReduce because it was too difficult, then a Hive tutorial is just what you need to get started on the most exciting big data journey. 

(viii) The schema information is stored in the traditional relational database. The component that does this is known as Metastore.

You may remember from the previous section of the Hive tutorial that Hivelets you interact with the traditional databases as well. You can use the JDBC interface or the Web GUI for it. 

Data Scheme Tables

Data Scheme Tables Source -Pixabay

All the files in Hive are not the same. There are different file formats that Hive supports.

(i) Text File – This is the default format where the data is stored in lines known as records. 

(ii) Sequence File – The file is in binary format, and it stores values as key-value pairs. 

(iii) RC File – The row columnar format offers high row-level compression rate and lets you perform queries on multiple rows simultaneously. 

(iv) ORC File – You can think of this as an optimised version of the RC file. 

(v) Parquet File – It is a column-oriented binary file that is very efficient for large-scale queries. 

(vi) AVRO File – What is Hive AVRO file? It is a format that lets you exchange data between the Hadoop ecosystem and programs in other languages. AVRO is making Hive-Hadoop for versatile. It is also making it exciting and easier to learn Hive.    

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 23rd Jan, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

Hive Architecture

Before understanding how Hive works, you need to understand the Hive architecture from the Hive tutorial.

Let us find out more about what is Hive and its components.  

Hive Architecture

Hive Architecture Source – Tutorials Point

1. User Interface 

The command-line interface and web UI connect the external users with Hive. You submit your queries, process the instructions, and manage them via these user interfaces.

If you are using a Windows server, then you can also use the Hive HD Insight as the user interface.

2. Metastore

The Metastore contains the metadata about the database. It holds the information about the location and schema of the tables and the partition metadata.

The partition metadata lets you monitor the distributed data in the cluster. The Metastore essentially tracks the data, duplicates it and provides backups in case of a data loss. The Metastore is present on a relational database.     

3. HiveQL Process Engine

The HQL process engine comprises of a driver and a compiler. The driver receives the HQL statements.

It monitors the lifecycle of different processes and also stores the metadata that is generated during the HQL execution. The compiler converts the HQL query into MapReduce inputs. 

4. Executor

Once the compiler has converted the HQL query into MapReduce inputs, the executor interacts with the job tracker in Hadoop to schedule the tasks and complete the execution. 


The Hadoop Distributed File System is the place where the data is stored by Hive. 

Hive Tutorial on Its Working

Now that you know the architecture of the Hive, lets us see how the various components interact to carry out the queries.

Understanding how Hive works is crucial for anyone who wants to learn Hive. No Hive tutorial will ever be complete without this step. 

Hive Working

Hive Working Source – Cwiki

(i) The user enters the query into the CLI or the Web UI which form the user interface of Hive architecture. The user interfaces forwards the query to the driver for execution.

(ii) The driver passes on the query to the compiler which checks it to ensure that the syntax is correct, and all the requirements are met. 

(iii) The compiler needs the metadata to proceed further. It sends a request for the Metastore for the metadata.     

(iv) Once the compiler has received the required metadata from the Metastore, it resends the plan of execution to the driver. 

(v) The driver forwards this plan to the execution engine to carry out the final steps. Up until here, we were dealing exclusively with the Hive side of the Hive architecture. The next few steps take place inside the Hadoop framework. 

(vi) The execution engine sends the task to the JobTracker within the MapReduce module of the Hadoop framework. The JobTracker is a Name node. 

(vii) The JobTracker assigns this task to the TaskTracker. The TaskTracker is a Data node. 

(viii) The query gets executed and the result is sent back to the Hive’s execution engine.

(ix) The executor forwards these results to the driver, which then forwards it to the Hive’s user interface. 

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 23rd Jan, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

Advantages of Hive

The increase in the demand for Hive tutorials and the increased enthusiasm to learn Hive is perfectly justified if you think about the Hive’s advantages. Here is a brief overview.

(i) HiveQL is easy to learn. If you know SQL, the transition to HQL will be very smooth. It makes it easier for developers to engage with Hive. 

(ii) You can interlink the UDFs in Hive with other Hadoop packages such as Apache Mahout, RHive, RHipe, etc. When you have to deal with multiple data formats and complex processing, this feature comes as a boon. 

(iii) Hive is built on top of a distributed system. It allows for faster querying and increases productivity.

(iv) Hive lets multiple users access data simultaneously. It increases the response time. 

(v) You can write MapReduce programs with ease. 

(vi) While it is similar to relational databases, its foundation is a much more advanced HDFS system.

(vii) You can add more clusters of data without reducing the performance of Hive, making it very flexible and scalable. 

(viii) Your source data may be unstructured. But Hive converts it and stores it in a structured format. Structured data is much easier to work with and speeds up the data analysis. 

(ix) It even allows you to work with traditional databases via the ODFS/JDFS interface. Hive is a truly versatile and flexible tool. 

Why You Should Learn Hive

Hadoop is one of the most trusted and widely used big data frameworks. The Hadoop ecosystem offers multiple functionalities that is a dream of anyone working with big data.

Every organisation is looking to leverage the capabilities of big data. To do this, they need developers and software engineers who are well-versed in big data tools.

Since Hadoop is the industry leader in this field, almost every organisation is on the lookout for employees with the relevant skills in this area. 

Why should you learn Hive?

Why should you learn Hive? Source – Vimeo

Hadoop comprises of multiple tools. It is fair to ask why you should select Hive tutorial over the others. The simple answer is that it has the lowest entry barrier.

If you know SQL, then learning HiveQL is a cakewalk. Even if you have no previous experience with any query language, you would find that it is very easy to learn Hive QL. 

Hive is the easiest way to get your foot through the door of the Hadoop framework. Once you get started with Hive, you will feel more confident and can extend your area of expertise to the other Hadoop tools.

Since Hive integrates with some of the other tools, you can start with those. 

The Hadoop ecosystem has grown over time. There is a Hadoop tool that can perform any big data task that you want. The ecosystem is still evolving and growing.

Becoming a part of the Hadoop workforce will vastly increase your employability. A Hive tutorial is all you need to do this. It can increase your career options.

A simple google search for ‘What is Hive salary’ will tell you that the average salary commanded by Hive developers is around USD 98,000.  

If you are a fresher, then you know how important it is to have certification on the most sought after skills. It helps set you apart from the crowd and forces the companies to take notice.

You can achieve this with a certified Hive tutorial. Even if you are an experienced professional who feels stuck in your career and wants to acquire new skills to climb up the ladder of the organisation, Hive tutorial is the perfect option for you.   

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 23rd Jan, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

Learn Hive Today

Hopefully, by now you have a clear idea of what is Hive, the Hive architecture, and how Hive works. However, this post was just an introduction.

Now that you are aware of what Hive is all about, you can easily go ahead and build a career in it. You can also have a look at these Hive Interview Questions to build a solid base for your next interview.

A Hive tutorial in conjunction with other Hadoop tools can help you enhance your Hadoop knowledge. The Data Science Master course by Digital Vidya is just what you need for this.

The course covers Hadoop tools from Hive to Spark. It is taken by industry experts and promises to offer you a comprehensive and well-rounded Hadoop learning experience.

Attend FREE Webinar on Data Science & Analytics for Career Growth

Date: 23rd Jan, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)

  • This field is for validation purposes and should be left unchanged.

You May Also Like…

An overview of Anomaly Detection

An overview of Anomaly Detection

Companies produce massive amounts of data every day. If this data is processed correctly, it can help the business to...


Submit a Comment

Your email address will not be published. Required fields are marked *