Skip to main content

Apache Hive

At a glance
  • Problem solved: query Hadoop data in SQL instead of writing MapReduce programs in Java.
  • Era: designed at Facebook after 2007, open sourced in August 2008, Apache top-level project on September 22, 2010, ACID transactions in 2014.
  • Created by: Ashish Thusoo and Joydeep Sen Sarma, Facebook's Data Infrastructure team.
  • Category: data warehouse / SQL engine on Hadoop, catalog (Hive Metastore).

Historical context​

In 2007, Facebook's data processing infrastructure was built around a data warehouse on a commercial RDBMS. Data was exploding: from 15 TB in 2007 to 2 PB in 2009. Some daily jobs were taking "more than a day to process", and the situation was getting worse every day.

Facebook moved to Hadoop: the same jobs dropped to a few hours. But Hadoop "was not easy for end users": you had to write a MapReduce program even for counts or averages. Ashish Thusoo and Joydeep Sen Sarma, from the Data Infrastructure team, started Hive with a clear vision: bring "tables, columns, partitions and a subset of SQL" to the unstructured world of Hadoop.

Hive was open sourced in August 2008, first as a Hadoop subproject. The paper presented at VLDB (Lyon, August 2009) already describes a warehouse of over 700 TB, several thousand tables, more than 100 users and over 5,000 queries a day. In June 2009, Facebook was loading 15 TB a day into a Hive/Hadoop cluster holding more than 2 PB of uncompressed data.

On September 22, 2010, the ASF board made Hive a top-level project, with Namit Jain as Vice President and an 11-person committee that included both founders. Hive then evolved in layers: ACID transactions (0.13, 2014), the LLAP daemon (2.0, 2016), then in 2025 a standalone Metastore and a REST catalog: the catalog had become a component in its own right.

Key idea​

Separate the schema from the files. A catalog, the Hive Metastore, describes tables (columns, types, location, partitions, format) laid over HDFS directories; a compiler translates SQL (HiveQL) into distributed jobs. For the 2009 paper, the Metastore is what distinguishes Hive "as a traditional warehousing solution (ala Oracle or DB2)" compared with Pig or Scope.

How it works​

Data model.

  • A table maps to an HDFS directory.
  • A partition is a subdirectory: a table partitioned by ds and ctry stores its data under /wh/T/ds=20090101/ctry=US. The optimizer prunes partitions the query does not need.
  • A bucket is a file in the partition, chosen by hashing a column.
  • Formats are extensible through SerDes (serializer/deserializer) written in Java.

Architecture (2009). Interfaces (CLI, web, JDBC, ODBC through a Thrift server); a Driver that manages the query life cycle; a Compiler that produces "a DAG of map-reduce jobs"; an execution engine, Hadoop. The Metastore lives in a relational database (MySQL, Oracle) or a local file system, not in HDFS.

Example from the paper. A single scan feeds two summary tables (a plan of 3 MapReduce jobs):

FROM (SELECT a.status, b.school, b.gender
FROM status_updates a JOIN profiles b
ON (a.userid = b.userid and a.ds='2009-03-20')
) subq1
INSERT OVERWRITE TABLE gender_summary PARTITION(ds='2009-03-20')
SELECT subq1.gender, COUNT(1) GROUP BY subq1.gender
INSERT OVERWRITE TABLE school_summary PARTITION(ds='2009-03-20')
SELECT subq1.school, COUNT(1) GROUP BY subq1.school

ACID, later. In 2009, "HiveQL currently does not support updating and deleting rows". Hive 0.13 adds transactions, Hive 0.14 INSERT, UPDATE, DELETE. Since HDFS cannot change files in place, each table has base files and delta files merged at read time, then rewritten by minor and major compactions. At first: ORC format only, snapshot isolation.

By the numbers​

FigureContextSource
15 TB then 2 PBFacebook's data in 2007, then in June 2009Facebook post, 2009
More than a dayDuration of some daily jobs on the old warehouse (2007)Facebook post, 2009
15 TB a dayData loaded into Facebook's Hive/Hadoop cluster (2009)Facebook post, 2009
Over 700 TBFacebook's Hive warehouse, several thousand tables (2009)VLDB 2009 paper
Over 5,000Queries per day on that warehouse (2009)VLDB 2009 paper
20%HiveQL overhead versus a hand-optimized Hadoop job (2009)VLDB 2009 paper
11 peopleApache Hive project committee at creation (September 2010)ASF board, 2010
9083Default Thrift port of the Metastore, used by TrinoTrino docs

Milestones​

  • 2007: Facebook's warehouse, on a commercial RDBMS, holds 15 TB and is overwhelmed; the Data Infrastructure team turns to Hadoop.
  • August 2008: Hive is open sourced.
  • August 2009: paper "Hive - A Warehousing Solution Over a Map-Reduce Framework" at VLDB (Lyon).
  • September 22, 2010: the Apache Hive project is created, Namit Jain Vice President.
  • March 2013: HCatalog merges into Hive.
  • April 21, 2014: Hive 0.13, ACID transactions; 0.14 (November 12, 2014) adds UPDATE and DELETE.
  • February 15, 2016: Hive 2.0, with LLAP (long-lived daemons for interactive queries).
  • May 21, 2018: Hive 3.0, new on-disk layout for ACID tables.
  • March 29, 2024: Hive 4.0; end of life of the 1.x, 2.x and 3.x branches the same year.
  • July 31, 2025: Hive 4.1, standalone Metastore (binary and Docker image) and REST catalog.

Did you know?​

  • The 2009 paper admits a "naive rule-based" optimizer with "a small number of simple rules".
  • Lacking a rank function, the paper computes the top 10 "memes" per school with a Python script plugged in as a reducer, right inside the query.
  • Facebook had built Hipal, an ad hoc analysis UI, and Databee, a dependency manager for processing tasks, around Hive.
  • The Metastore lives beyond Hive: Trino requires a Hive Metastore (or an equivalent such as AWS Glue) for its Hive connector.

Strengths and limitations​

StrengthsLimitations
SQL on Hadoop, without writing MapReduceHigh latency at first: every query becomes batch jobs
Metastore reused by other engines (Impala, Trino)Rudimentary optimizer at first
Partitions and SerDes: adapts to existing dataNo UPDATE or DELETE before 2014, then ACID limited to ORC
Extensible (UDFs, map/reduce scripts)ACID through delta files: compactions to manage

What came next​

  • Impala and Trino reuse the Metastore for interactive SQL, without MapReduce.
  • ORC was created in January 2013 to speed up Hive (shipped in Hive 0.11) and became the foundation of its ACID support.
  • YARN opens the cluster to other engines, including Tez, which Hive 4 recommends instead of MapReduce.
  • Iceberg takes on transactional tables over files: each write produces a new metadata file and snapshot, with lock-free reads; Hive 4.2 (November 2025) strengthens its support.

Sources​

To do
  • Find a primary source for Tez becoming an execution engine (Stinger initiative) and the date of Hive on Spark.
  • Source Spark's use of the Hive Metastore.
  • Read the ICDE 2010 paper PDF (server unreachable, only the IEEE abstract was read).
  • Origin of the name "Hive" not found in a primary source.