DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
What's in store for DevOps in 2023? Hear from the experts in our "DZone 2023 Preview: DevOps Edition" on Fri, Jan 27!
Save your seat
  1. DZone
  2. Data Engineering
  3. Big Data
  4. Hive Database: A Basic Introduction

Hive Database: A Basic Introduction

An introduction to the architectural details for Hive and how it interacts with Hadoop.

Sangeeta Gulia user avatar by
Sangeeta Gulia
·
Dec. 15, 16 · Tutorial
Like (8)
Save
Tweet
Share
14.31K Views

Join the DZone community and get the full member experience.

Join For Free

What Is Hive?

Hive is a data warehouse infrastructure tool that processes structured data in Hadoop. It resides on top of Hadoop to summarize Big Data and makes querying and analyzing easy.

Why Use Hive?

  • Most data warehousing applications work with SQL-based querying language. Hive supports easy portability of SQL-based applications to Hadoop.

  • Faster results for even the most tremendous datasets.

  • As data volume and variety increase, more machines can be added without any corresponding reduction in the performance

Features of Hive

  • It accelerates queries as it provides indexes, including bitmap indexes.

  • It stores metadata, which reduces the time to perform semantic checks during query execution.

  • It provides built-in functions to manipulate dates, strings, and other data-mining tools.

  • It supports different file formats like Avro Files, ORC Files, Parquet, etc.

Architecture of Hive

Major components of hive are as follows

Metastore

This component is responsible for storing all the structure information of the various tables and partitions in the warehouse, including column and column type information, serializers, and de-serializers necessary to read and write data and the corresponding HDFS files where the data is to be stored.

Driver

It acts like a controller that receives the HiveQL statements and starts the execution of statements by creating sessions and monitors the life cycle and progress of the execution. It stores the necessary metadata generated during the execution of an HiveQL statement. The driver also acts as a collection point of data or query result obtained after the Reduce operation.

Compiler

The component that parses the query, does semantic analysis on the different query blocks and query expressions, and eventually, generates an execution plan with the help of the table and partition metadata looked up from the Metastore.

In other words, the process can be described by the following flow:

Parser —> Semantic Analyser —> Logical Plan Generator —> Query Plan Generator.

Optimizer

Performs various transformations on the execution plan to get an optimized DAG (directed acyclic graph).

Executor

After compilation and optimization, the executor executes the tasks according to the DAG. It interacts with the job tracker of Hadoop to schedule tasks to be run. It takes care of pipelining the tasks by making sure that a task with dependency gets executed only if all other prerequisites are run.

CLI, UI, and Thrift Server

Interface that can be used by the users to submit queries and get the result.

How Does Hive Interact With Hadoop?

Execute Query

From the Hive interface (UI or Command Line), the query is sent to the driver for execution.

Check Syntax and Get Plan

The driver takes the help of query compiler, which parses a query to check the syntax and query plan or requirement of a query.

Get Metadata

The compiler sends metadata request to Metastore and in return, Metastore sends metadata as a response to the compiler.

Execute Plan

The compiler checks the requirement and resends the plan to the driver. The driver sends the execute plan to the execution engine.

Execute Job

An execution engine such as Tez or MapReduce executes the compiled query. The resource manager, YARN, allocates resources for applications across the cluster. The execution engine sends the job to JobTracker, which is in the Name node, and it assigns this job to TaskTracker, which is in the Data node. Here, the query executes the MapReduce job.

Fetch Query Result

The execution engine receives the result from data nodes and sends it to the driver, which returns the result to the Hive interface over a JDBC/ODBC connection.

After knowing all these internal details about the execution of hive queries, I hope you will find it more interesting to work on.

References

  • Hives Introduction

  • Apache Hive

Database Big data Execution (computing)

Published at DZone with permission of Sangeeta Gulia, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Required Knowledge To Pass AWS Certified Data Analytics Specialty Exam
  • Simulating and Troubleshooting StackOverflowError in Kotlin
  • Essential Mobile App Security Tips for Coders in 2023: Make Your App Unhackable
  • How to Perform Accessibility Testing of Websites and Web Apps

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: