The Hadoop ecosystem: Hive, HBase, ZooKeeper and more

Hadoop itself is HDFS, YARN and MapReduce. Around it grew a family of projects that let analysts write SQL, apps look up single rows, pipelines ingest events and admins secure everything. This lesson maps them by layer, marks which are alive and which retired, and runs SQL on our own cluster to show the MapReduce pattern still inside.

Module 13 · Hadoop in industry today⏱ 28 minBeginnerReal Spark SQL run on YARNEcosystem map + 2 animationsStatus checked 22 Oct 20268 practice problems
1 The story

Twenty names in one meeting

Riya joins the data team of a food-delivery company for her internship. In the first stand-up she hears: “Kafka lag is fine, the Iceberg compaction ran, the Hive table is late because Airflow retried, and HBase is serving the restaurant lookups.” She has spent twelve modules on HDFS, YARN and MapReduce. Where do all these other names fit?

Hadoop core HDFS · stores files YARN · runs containers MapReduce · processes bring data inKafka, NiFi ask in SQLHive, Spark SQL, Trino, Impala faster enginesTez, Spark, Flink look up one row fastHBase (+ Phoenix) agree on who is leaderZooKeeper schedule · secureAirflow · Ranger, Atlas myphatshala.in
Riya

Sir, is every one of these names a part of Hadoop?

Arjun Sir

No. Hadoop itself is only three things you already know: HDFS, YARN and MapReduce (plus the shared Common libraries). The rest are separate projects that grew around it, most of them at the Apache Software Foundation. Each one fills a gap: SQL for analysts, fast row lookups, ingestion, scheduling, security.

Kabir

And some of them are gone. Our old runbooks still mention Sqoop and Oozie, but nobody installs them on new clusters.

Arjun Sir

Right. Today we draw the map: what each project does, which ones are alive, which ones retired, and where each sits on top of HDFS and YARN. Then we run one of them, Spark SQL, on our own cluster and see the old MapReduce pattern inside its plan.

2 Definition

The Hadoop ecosystem

Formal definition (write this in exams)

The Hadoop ecosystem is the set of open-source projects built to work with the core Hadoop components — the HDFS distributed file system, the YARN resource manager and the MapReduce processing framework. It includes storage and table layers (HBase, Ozone, Apache Iceberg/Delta Lake/Apache Hudi), a shared metastore for table definitions, processing engines (Tez, Spark, Flink), SQL engines (Hive, Impala, Trino, Spark SQL, Drill), coordination (ZooKeeper), ingestion (Kafka, NiFi), workflow scheduling, security and governance (Ranger, Knox, Atlas) and cluster management tools. These components read and write data in HDFS or compatible storage and usually run their work as YARN applications, so one cluster can serve batch, interactive SQL, streaming and low-latency lookups.

In simple words

Hadoop is the ground floor: a place to keep huge files and a way to share machines. The ecosystem is everything built on that floor so that different people can use the data in their own way: SQL for analysts, fast lookups for apps, pipelines for engineers.

Words you'll meet in this lesson

MetastoreA database of table definitions (columns, file location, format) shared by Hive, Spark, Trino and others.
SQL-on-HadoopEngines that turn SQL into distributed work over files in HDFS.
Table formatIceberg, Delta Lake, Hudi: metadata on top of Parquet files that adds snapshots, updates and deletes.
HBaseA NoSQL store on HDFS for fast reads and writes of single rows by key.
ZooKeeperA small, very reliable service for leader election, locks and configuration.
Execution engineWhat actually runs a query: MapReduce, Tez or Spark.
Apache AtticWhere retired Apache projects go: code stays readable, no more releases.
DormantA project with no active development that has not formally retired.

From our lab (Spark 4.0.4 on our YARN cluster)

TableAn EXTERNAL table canteen.orders over student_orders.csv in HDFS; no data copied, only a definition stored in a local metastore
MetastoreDESCRIBE shows Hive classes: Serde Library org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
QueryGROUP BY item over 5 lakh orders in 11.1 s: thali first by revenue (₹24,23,360), chai first by orders (1,49,669)
Planpartial_count → Exchange hashpartitioning → count: the map-side combine, shuffle and reduce of Modules 8–9
Not runApache Hive itself: Hive 4.2 needs JDK 21 (our image has 17) and the Hive 4.1 download from archive.apache.org was too slow

Architecture at a glance

The ecosystem in layers, bottom to top. Everything runs on HDFS (or cloud object storage) and most of it runs inside YARN containers. Grey boxes are retired or dormant projects you will still meet in older clusters and job descriptions.

STORAGE HDFS Ozone S3 / ADLS / GCS Parquet · ORC · Avro TABLES Iceberg · Delta · Hudi Metastore (Hive Metastore) HBase · Kudu RESOURCES YARN (or Kubernetes) ENGINES MapReduce · Tez · Spark · Flink SQL Hive · Spark SQL · Trino · Impala · Drill Ingestion Kafka · NiFi Workflow Airflow Coordination ZooKeeper Security · governance Ranger · Knox · Atlas Sqoop (retired 2021) Flume (dormant 2024) Oozie (retired 2025) Sentry (retired 2020) Falcon (retired 2019) grey dashed = retired or dormant myphatshala.in

The ecosystem at three levels

Pick your level. New to this? Start at Beginner and climb.

Beginner A railway station, not a train

  • Think of HDFS as the tracks and YARN as the station master who decides which platform each train gets.
  • MapReduce was the first train. Later came faster trains (Tez, Spark) on the same tracks.
  • Hive and Trino are ticket counters that speak SQL; HBase is the enquiry window that answers one question instantly; ZooKeeper is the signal system everybody trusts.
  • Some counters closed over the years (Sqoop, Oozie) and new ones opened (Airflow, Iceberg). The tracks stayed.

Intermediate One job per project

  • Hive: SQL tables over files; the Hive Metastore became the shared catalogue every engine reads.
  • HBase: random reads and writes by row key on top of HDFS, e.g. a delivery app looking up a restaurant by ID.
  • ZooKeeper: who is the active NameNode (Lesson 7.1), which HBase server owns which rows, Kafka's older controller.
  • Kafka: a durable log of events (orders, clicks) that pipelines read in order. NiFi: drag-and-drop data flows.
  • Spark / Tez / Flink: engines that replaced MapReduce for most jobs; Flink for continuous streams.
  • Ranger, Knox, Atlas: access policies, a secure gateway, and lineage/catalog (Lesson 12.5).

Advanced How they map onto the core

  • Almost every engine is a YARN application: its own ApplicationMaster plus containers (Lesson 11.2). Our Spark SQL query ran exactly like that.
  • Data lives in HDFS files; the metastore only stores schema + location, which is why one table can be read by Hive, Spark and Trino.
  • Engines still follow map → shuffle → reduce; Spark's plan shows partial aggregation, an Exchange (shuffle) and final aggregation.
  • HBase is the exception: long-running RegionServers keep data in memory and write HFiles to HDFS; it uses ZooKeeper, not YARN, for coordination.

Exam tip: For “Explain the Hadoop ecosystem”, draw three layers (storage HDFS, resource management YARN, processing engines) and place 6–8 projects with one line each: Hive (SQL), HBase (NoSQL, random access), ZooKeeper (coordination), Spark (in-memory processing), Kafka (ingestion), Ranger (security). Mention that Sqoop and Oozie are retired.

3 Types and ways to use it

Who does what, and who is still alive

LayerProjectUsed forExampleStatus (checked 22 Oct 2026)
SQLHiveSQL tables over HDFS files; metastoreDaily sales reportActive: 4.2.1 (Aug 2026); 1.x–3.x lines end of life
EngineSparkBatch, SQL, ML, streaming in memoryFeature tables for a modelActive: 4.2 (Jul 2026); 3.5 LTS to Nov 2027
EngineTezDAG engine under HiveHive queries without MapReduceActive (not in the Attic)
NoSQLHBaseFast reads/writes by row keyRestaurant lookup by IDActive (2.6.x in Amazon EMR 7.14 and Cloudera 7.3.2)
CoordinationZooKeeperLeader election, locks, configActive/standby NameNodeActive (3.9.3 in EMR 7.14)
SQLTrino, Impala, DrillFast interactive SQLAnalyst dashboardsActive
TablesIceberg, Delta, HudiUpdates, deletes, snapshots on ParquetGDPR-style deletes, time travelActive (Iceberg 1.10 in EMR 7.14)
IngestionSqoopCopy RDBMS tables to HDFSNightly MySQL importRetired Jun 2021 (Apache Attic)
IngestionFlumeShip log events to HDFSWeb server logsDormant since 10 Oct 2024
WorkflowOozieSchedule chains of Hadoop jobsHourly ETLRetired Feb 2025 (still shipped in EMR 7.14)
SecuritySentryRole-based SQL permissionsHive grantsRetired Dec 2020 → Ranger
ScriptingPigData-flow scripts compiled to MapReduceLog cleaningNot retired; still in EMR 7.14 (0.17.0) but rarely chosen for new work

Replacements you will see in job descriptions

Sqoop → Spark JDBC / CDC

Spark reads databases over JDBC; change-data-capture tools stream row changes into Kafka.

ingestion

Flume → Kafka

Applications publish events to Kafka; connectors or Spark write them to HDFS or object storage.

events

Oozie → Airflow

Workflows as Python DAGs with retries, sensors and a web UI.

scheduling

MapReduce → Spark / Tez

Same map–shuffle–reduce idea, with memory and better plans (next lesson).

engines

Animated example: one day of data at a food-delivery company

From an order to a dashboard 6 steps
Animated example Kafka HDFS+Iceberg Spark Trino/Hive dashboard HBase ZooKeeper 13:02 · order #8841 for biryani, Pune.The app publishes an event to a Kafka topic. 13:07 · a small job writes the last 5 minutesinto an Iceberg table on HDFS (one commit). 13:07 · the app asks HBase: restaurant R-219?One row by key in milliseconds, not a scan. 01:00 · Spark on YARN builds daily tables:orders per city, late deliveries, refunds. 09:30 · an analyst runs SQL in Trino;the metastore tells it where the files are. All day · ZooKeeper keeps the masters agreedactive NameNode, HBase region owners myphatshala.in

When a project name is new to you, ask three questions: where does its data live (HDFS, its own servers, memory), does it run on YARN, and is it still released. Those answers place it on the map in a minute.

4 Step by step

SQL on Hadoop, on our own cluster

We added Spark 4.0.4 (downloaded from dlcdn.apache.org) to the Module 8 lab's namenode container and ran spark-sql on YARN with three 512 MB executors. The SQL file is in “Run it on your PC”.

  1. Define a table over an existing HDFS file

    CREATE TABLE canteen.orders (order_id BIGINT, student STRING, ts STRING, item STRING, amount INT)
      USING csv OPTIONS (path 'hdfs://namenode/user/hadoop/data/student_orders.csv');
    Time taken: 0.753 seconds
    Nothing was copied. The metastore stored the columns and the file location: under a second.
  2. Look at what the metastore knows

    DESCRIBE TABLE EXTENDED canteen.orders;
    Type EXTERNAL Provider csv Location hdfs://namenode/user/hadoop/data/student_orders.csv Serde Library org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
    EXTERNAL means dropping the table leaves the file alone. The Hive class names show where the metastore idea came from.
  3. Ask a business question

    SELECT item, count(*) AS orders, sum(amount) AS revenue
    FROM canteen.orders GROUP BY item ORDER BY revenue DESC;
    thali 30292 2423360 dosa 49927 2246715 chai 149669 2245035 vada pav 69754 1395080 … coffee 40364 807280 Time taken: 11.084 seconds, Fetched 8 row(s)
    The same numbers our Java jobs produced in Module 9, written as one SQL statement. Thali earns most with the fewest orders.
  4. A second question, no new code

    SELECT substr(ts, 12, 2) AS hour, count(*) AS orders
    FROM canteen.orders GROUP BY 1 ORDER BY orders DESC LIMIT 3;
    14 62213 13 56026 08 55852 Time taken: 2.838 seconds, Fetched 3 row(s)
    Lunch (13–14 h) and breakfast (08 h) are the rush hours. With Java MapReduce this would be a new Mapper, Reducer and jar.
  5. See MapReduce inside the plan

    EXPLAIN SELECT item, count(*) FROM canteen.orders GROUP BY item;
    +- HashAggregate(keys=[item#14], functions=[count(1)]) +- Exchange hashpartitioning(item#14, 200) +- HashAggregate(keys=[item#14], functions=[partial_count(1)]) +- FileScan csv spark_catalog.canteen.orders[item#14] … ReadSchema: struct<item:string>
    Read from the bottom: scan only the item column, count per item inside each task (a combiner, Lesson 9.1), shuffle by hash of item (Lesson 9.2), add the partial counts (the reduce).

Our lab did not run Apache Hive itself: Hive 4.2 needs JDK 21 while the Hadoop image has JDK 17, and the Hive 4.1 download was too slow. Spark SQL uses the same table-and-metastore model, so the steps carry over; on a real cluster you would type the same SQL into Hive's Beeline.

5 See it happen

One SQL query through the stack

Six steps of our real spark-sql run: what the terminal showed, and which ecosystem layer did the work.

SQL → plan → YARN → HDFS 6 steps
What you see hadoop@namenode : /tmp/mr $ spark-sql --master yarn -f sql_on_hadoop.sqlqueue: root.default CREATE TABLE canteen.orders … USING csvTime taken: 0.753 seconds DESCRIBE TABLE EXTENDED canteen.ordersType EXTERNALLocation hdfs://namenode/…/student_orders.csvSerde …hive.serde2.lazy.LazySimpleSerDe EXPLAIN SELECT item, count(*) … GROUP BY itemHashAggregate count(1) Exchange hashpartitioning(item, 200) HashAggregate partial_count(1) FileScan csv [item] SELECT item, count(*), sum(amount) …thali 30292 2423360dosa 49927 2246715chai 149669 2245035Time taken: 11.084 seconds … GROUP BY hour ORDER BY orders DESC LIMIT 314 6221313 5602608 55852Time taken: 2.838 seconds myphatshala.in
Behind the screen spark-sql driver metastore_db YARN RM HDFS · student_orders.csv (19.4 MB) executor 1 executor 2 executor 3 driver asks YARN for 3 containers of 512 MB table definition written to the metastore only metastore: columns + location + format plan: partial count → shuffle → final count(combiner, partitioner, reducer of Module 9) executors read splits, count, shuffle by item same executors reused: 2.8 sno new containers to start myphatshala.in
6 Real-world use

The ecosystem at work

SQL reports

1. Retail: Hive and Trino for finance reports

A retail chain keeps years of bills as Parquet tables in HDFS; finance runs month-end SQL through Hive and quick checks through Trino on the same tables.

Bills (HDFS)→Metastore + SQL→Month-end report
row key lookup

2. Telecom: HBase for subscriber profiles

A telecom operator stores each subscriber's latest plan and usage in HBase so the care app fetches one customer in milliseconds, while nightly jobs scan the same data.

Mobile number→HBase get→Care screen

3. Payments: Kafka into the lake

A payments company publishes every transaction to Kafka; fraud rules read the stream in seconds and a sink job lands it in Iceberg tables for audits.

Transactions→Kafka→Fraud + Iceberg
Oozie → Airflowmigration

4. Insurance: moving off retired tools

An insurer rewrites its Oozie workflows as Airflow DAGs and its Sqoop imports as Spark JDBC jobs, one pipeline at a time, keeping both running until outputs match.

Oozie + Sqoop→Side-by-side runs→Airflow + Spark
lineageAtlas + Ranger

5. Healthcare research: governance first

A hospital research group tags patient columns in Atlas so Ranger masks them for analysts, and every query is audited.

Tagged columns→Ranger policies→Masked SQL results

Simplified; organisations differ in tools and policies.

Sources (checked 22 Oct 2026): Apache Attic: retired projects · Apache Flume README (dormant notice) · Apache Hive downloads · endoflife.date: Apache Spark · Amazon EMR 7.x application versions · Cloudera Base 7.3.2 summary

7 Run the code

Pick the right tool, then run a GROUP BY by hand

Part one is a tiny rule engine: describe a requirement and it suggests ecosystem projects. Part two does what our SQL engine did for GROUP BY item: partial counts per task (map + combine), a shuffle by key, and a final sum (reduce).

RULES = [  # (keyword in the requirement, suggestion)
    ("sql", "Hive / Spark SQL / Trino over metastore tables"),
    ("single row", "HBase (get by row key)"),
    ("events", "Kafka, then Spark or Flink"),
    ("update", "Iceberg / Delta / Hudi table format"),
    ("schedule", "Airflow (Oozie is retired)"),
    ("leader", "ZooKeeper"),
    ("access", "Ranger policies + Kerberos"),
]
def pick(req):
    return [tool for key, tool in RULES if key in req.lower()] or ["plain HDFS files + Spark"]

for r in ["Analysts need SQL on 3 years of bills",
          "App must fetch a single row per customer in 10 ms",
          "Clickstream events every second, update totals"]:
    print(f"{r[:44]:44} -> {pick(r)}")

# GROUP BY item, the way the plan executed it
tasks = [["chai", "dosa", "chai"], ["thali", "chai"], ["dosa", "chai", "thali"]]
partial = []
for t in tasks:                               # HashAggregate partial_count, per task
    counts = {}
    for item in t:
        counts[item] = counts.get(item, 0) + 1
    partial.append(counts)
print("partial counts:", partial)
final = {}
for counts in partial:                        # Exchange (shuffle by item) + final count
    for item, n in counts.items():
        final[item] = final.get(item, 0) + n
print("final        :", dict(sorted(final.items())))
Analysts need SQL on 3 years of bills -> ['Hive / Spark SQL / Trino over metastore tables'] App must fetch a single row per customer in -> ['HBase (get by row key)'] Clickstream events every second, update tota -> ['Kafka, then Spark or Flink', 'Iceberg / Delta / Hudi table format'] partial counts: [{'chai': 2, 'dosa': 1}, {'thali': 1, 'chai': 1}, {'dosa': 1, 'chai': 1, 'thali': 1}] final : {'chai': 4, 'dosa': 2, 'thali': 2}
  • return [tool for key, tool in RULES if key in req.lower()] or ["plain HDFS files + Spark"]A requirement can match several rules: real platforms combine tools.
  • for t in tasks: # HashAggregate partial_count, per taskThis loop is the combiner (Lesson 9.1): each task counts its own rows first.
  • for counts in partial: # Exchange (shuffle by item) + final countOnly small partial counts cross the network, then the reducer adds them.

Run it on your PC: SQL on Hadoop with Spark

Uses the Module 8 lab. Download Spark 4.0.4 (spark-4.0.4-bin-hadoop3.tgz from dlcdn.apache.org), copy it into the namenode container and unpack it. Spark needs to know where Hadoop's configuration is so it can find HDFS and YARN. Three executors of 512 MB fit our small cluster.

SQL over an HDFS file, on YARN

-- sql_on_hadoop.sql: SQL over files in HDFS, with a Hive-style metastore (Spark SQL, run on YARN)
CREATE DATABASE IF NOT EXISTS canteen;
DROP TABLE IF EXISTS canteen.orders;
CREATE TABLE canteen.orders (order_id BIGINT, student STRING, ts STRING, item STRING, amount INT)
  USING csv OPTIONS (path 'hdfs://namenode/user/hadoop/data/student_orders.csv');
DESCRIBE TABLE EXTENDED canteen.orders;
SELECT item, count(*) AS orders, sum(amount) AS revenue FROM canteen.orders GROUP BY item ORDER BY revenue DESC;
SELECT substr(ts, 12, 2) AS hour, count(*) AS orders FROM canteen.orders GROUP BY 1 ORDER BY orders DESC LIMIT 3;
EXPLAIN SELECT item, count(*) FROM canteen.orders GROUP BY item;

-- In the namenode container (after unpacking Spark into /tmp/opt):
--   export SPARK_HOME=/tmp/opt/spark-4.0.4-bin-hadoop3
--   export HADOOP_CONF_DIR=/opt/hadoop/etc/hadoop
--   $SPARK_HOME/bin/spark-sql --master yarn --num-executors 3 --executor-memory 512m \
--       --executor-cores 1 --driver-memory 512m -f sql_on_hadoop.sql
Time taken: 1.272 seconds Time taken: 0.096 seconds Time taken: 0.753 seconds order_id bigint student string ts string item string amount int # Detailed Table Information Catalog spark_catalog Database canteen Table orders Owner hadoop Created Time Thu Oct 22 11:28:09 UTC 2026 Last Access UNKNOWN Created By Spark 4.0.4 Type EXTERNAL Provider csv Location hdfs://namenode/user/hadoop/data/student_orders.csv Serde Library org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe InputFormat org.apache.hadoop.mapred.SequenceFileInputFormat OutputFormat org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat Time taken: 0.614 seconds, Fetched 20 row(s) thali 30292 2423360 dosa 49927 2246715 chai 149669 2245035 vada pav 69754 1395080 idli 44774 1343220 samosa 69884 1257912 poha 45336 1133400 coffee 40364 807280 Time taken: 11.084 seconds, Fetched 8 row(s) 14 62213 13 56026 08 55852 Time taken: 2.838 seconds, Fetched 3 row(s) == Physical Plan == AdaptiveSparkPlan isFinalPlan=false +- HashAggregate(keys=[item#14], functions=[count(1)]) +- Exchange hashpartitioning(item#14, 200), ENSURE_REQUIREMENTS, [plan_id=170] +- HashAggregate(keys=[item#14], functions=[partial_count(1)]) +- FileScan csv spark_catalog.canteen.orders[item#14] Batched: false, DataFilters: [], Format: CSV, Location: InMemoryFileIndex(1 paths)[hdfs://namenode/user/hadoop/data/student_orders.csv], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<item:string> Time taken: 0.177 seconds, Fetched 1 row(s) took 49 s metastore_db spark-warehouse

Real output with Spark's INFO/WARN logging filtered out. The first query takes longer (11.1 s) because executors and the plan warm up; later ones reuse them. spark-sql creates metastore_db (a local Derby metastore) and spark-warehouse in the folder you run it from.

8 Line by line

How a metastore answers “where is this table?”

An engine never scans HDFS looking for a table. It asks the metastore for the location and format, then plans the read.

Worked examples: real problems, solved and traced in memory

Four “which tool?” decisions from different industries, each reasoned from the requirement.

Example 1BeginnerRetail · SQL

Analysts want SQL on five years of sales

Problem statement

A retail chain has 5 years of daily sales as CSV files in HDFS. Analysts know SQL, not Java. What do you add, and do you need to copy the data?

Input
CSV in HDFS · SQL users
Expected output
Define an external table over 900 GB; copy needed: False
Engine: Hive or Spark SQL for batch, Trino for quick questions

Approach

  1. SQL over files = a metastore table + a SQL engine.
  2. An EXTERNAL table points at the files: nothing is copied.
  3. Later, convert to Parquet for speed (Lesson 10.2).

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 2IntermediateTelecom · NoSQL

Customer care needs one subscriber in 10 ms

Problem statement

A care agent types a mobile number and must see the plan and last recharge within 10 ms. The data is 40 crore rows. Is Hive the right choice?

Input
40 crore rows · 1 row per request · 10 ms
Expected output
full scan on one disk: 8 minutes; HBase get by key: a few milliseconds

Approach

  1. A SQL engine scans files; even a fast one takes seconds.
  2. A key-value store reads one row by key directly.
  3. Keep both: HBase for lookups, Parquet tables for analytics.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 3IntermediateLogistics · workflow

Replacing Oozie after its retirement

Problem statement

A logistics firm runs 120 Oozie workflows. Oozie was retired to the Apache Attic in February 2025. Plan the move and estimate effort at 1.5 days per workflow with 2 engineers.

Input
120 workflows · 1.5 days each · 2 engineers
Expected output
90 working days, about 4.3 months

Approach

  1. Target: Airflow DAGs calling the same Spark/Hive jobs.
  2. Migrate in waves, run old and new side by side, compare outputs.
  3. Estimate calendar time.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 4AdvancedFintech · tables

Deleting one customer's data on request

Problem statement

A fintech must delete a customer's records on request from a 2 TB transactions table stored as Parquet in HDFS (5,000 files). Plain Parquet files cannot be edited in place. Compare rewriting everything with a table format.

Input
2 TB · 5,000 files · rows of 1 customer spread over ~40 files
Expected output
rewrite everything: 2048 GB; table format rewrites ~16.4 GB in 40 files

Approach

  1. Plain files: rewrite every file that contains the customer, and know which ones they are.
  2. Iceberg/Delta/Hudi: DELETE … WHERE customer = …, rewriting only affected files and committing a snapshot.
  3. Compare bytes rewritten.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

9 Quiz and revision

Check yourself

Quick revision

Lesson 13.1 in one screen

  • Hadoop = HDFS + YARN + MapReduce (+ Common). The ecosystem is built around it.
  • Layers: storage (HDFS, Ozone, object stores) → tables (Iceberg/Delta/Hudi, metastore, HBase, Kudu) → YARN → engines (MapReduce, Tez, Spark, Flink) and SQL (Hive, Spark SQL, Trino, Impala, Drill).
  • Around them: ingestion (Kafka, NiFi), workflow (Airflow), coordination (ZooKeeper), security (Ranger, Knox, Atlas).
  • Retired: Sqoop (Jun 2021), Sentry (Dec 2020), Oozie (Feb 2025); Flume dormant since Oct 2024 (checked 22 Oct 2026).
  • Metastore = table definitions; engines share it. EXTERNAL tables just point at files.
  • Lab: Spark SQL on YARN, GROUP BY over 5 lakh orders in 11.1 s; plan = partial aggregate → shuffle → final aggregate.

Interview and viva questions

What are the main components of the Hadoop ecosystem?

The core is HDFS (storage), YARN (resource management) and MapReduce (processing). Around it: Hive and other SQL engines (Spark SQL, Trino, Impala), HBase for low-latency key access, ZooKeeper for coordination, Spark, Tez and Flink as processing engines, Kafka and NiFi for ingestion, Airflow for scheduling, Ranger, Knox and Atlas for security and governance, and table formats such as Apache Iceberg.

What is the difference between Hive and HBase?

Hive is a SQL engine over files: good for scanning and aggregating large tables, with query times of seconds to minutes. HBase is a NoSQL store for reading and writing individual rows by key in milliseconds. Many systems use both: HBase to serve applications, Hive or Spark for analytics.

Is Sqoop still used?

Apache Sqoop was retired to the Apache Attic in June 2021, and Amazon EMR stopped including it from release 7.4.0. Older clusters may still run it, but new pipelines usually use Spark JDBC reads or change-data-capture into Kafka.

Why does Hadoop need ZooKeeper?

Distributed services must agree on facts such as which NameNode is active or which HBase server owns which rows, even when machines fail. ZooKeeper provides a small, replicated, strongly consistent store with watches and ephemeral nodes that these services use for leader election, locks and configuration.

What is the Hive metastore?

A service and database holding table and partition definitions: column names and types, storage format, and file locations. Hive, Spark, Trino, Impala and others share it, so a table defined once can be queried by many engines.

Practice problems

Ecosystem exercises: place projects, read our real results, and choose tools.

P1Easy

Average order value per item

From our real GROUP BY, compute revenue per order for thali, dosa and chai.

Input
thali 30292 2423360 · dosa 49927 2246715 · chai 149669 2245035
Expected output
thali 80.0
dosa 45.0
chai 15.0
Show solution and explanation
for item, n, rev in [("thali", 30292, 2423360), ("dosa", 49927, 2246715), ("chai", 149669, 2245035)]:
    print(item, rev / n)
thali 80.0 dosa 45.0 chai 15.0

How it works: 80, 45 and 15: the menu prices, so the SQL result agrees with the data.

P2Easy

Share of the lunch rush

What share of all 5 lakh orders came in the 13 and 14 o'clock hours?

Input
13 → 56,026 · 14 → 62,213
Expected output
23.6%
Show solution and explanation
print(f"{(56026 + 62213) / 500000:.1%}")
23.6%

How it works: 23.6% of orders in two of the thirteen opening hours.

P3Easy

Retired or not

Count how many of these are retired or dormant: Sqoop, Hive, Oozie, Flume, HBase, Sentry.

Input
status table
Expected output
4
Show solution and explanation
gone = {"Sqoop", "Oozie", "Flume", "Sentry"}
print(len(gone & {"Sqoop", "Hive", "Oozie", "Flume", "HBase", "Sentry"}))
4

How it works: 4 of 6. Hive and HBase are active.

P4Medium

Layer sorter

Assign each project to its layer.

Input
8 projects
Expected output
HDFS       storage
Iceberg    tables
YARN       resources
Spark      engine
Trino      SQL
Kafka      ingestion
ZooKeeper  coordination
Ranger     security
Show solution and explanation
layer = {"HDFS": "storage", "Iceberg": "tables", "YARN": "resources", "Spark": "engine",
         "Trino": "SQL", "Kafka": "ingestion", "ZooKeeper": "coordination", "Ranger": "security"}
for p, l in layer.items():
    print(f"{p:10} {l}")
HDFS storage Iceberg tables YARN resources Spark engine Trino SQL Kafka ingestion ZooKeeper coordination Ranger security

How it works: The same layers as the architecture diagram.

P5Medium

Combiner savings

5 lakh rows, 8 items, 3 tasks. How many records cross the shuffle with and without partial aggregation?

Input
500,000 rows · 8 keys · 3 tasks
Expected output
without: 500000 with partial aggregation: 24
Show solution and explanation
rows, keys, tasks = 500_000, 8, 3
print("without:", rows, "with partial aggregation:", keys * tasks)
without: 500000 with partial aggregation: 24

How it works: 500,000 vs at most 24: why the plan aggregates before the Exchange.

P6Medium

Which engine?

Match: nightly 2 TB batch, ad-hoc analyst SQL in seconds, per-second event stream.

Input
3 workloads
Expected output
nightly 2 TB batch       -> Spark (or Hive on Tez)
ad-hoc SQL in seconds    -> Trino / Impala
per-second event stream  -> Flink or Spark Structured Streaming via Kafka
Show solution and explanation
m = {"nightly 2 TB batch": "Spark (or Hive on Tez)", "ad-hoc SQL in seconds": "Trino / Impala",
     "per-second event stream": "Flink or Spark Structured Streaming via Kafka"}
for k, v in m.items():
    print(f"{k:24} -> {v}")
nightly 2 TB batch -> Spark (or Hive on Tez) ad-hoc SQL in seconds -> Trino / Impala per-second event stream -> Flink or Spark Structured Streaming via Kafka

How it works: One cluster often runs all three on YARN or alongside it.

P7Business problem

Cost of a retired tool

A retired tool gets no security fixes. If an incident costs ₹50 lakh with a 5% yearly chance, and migration costs ₹12 lakh once, how many years until migration pays off?

Input
₹50 lakh × 5% vs ₹12 lakh
Expected output
4.8 years
Show solution and explanation
risk_per_year = 50 * 0.05
print(f"{12 / risk_per_year:.1f} years")
4.8 years

How it works: About 4.8 years on risk alone (illustrative); add support and hiring costs and it pays off sooner.

P8Advanced

Mini metastore

Build a dict-based metastore with create, describe and drop; EXTERNAL drop keeps files, MANAGED drop deletes them.

Input
2 tables
Expected output
tables: {} files left: {'/data/orders.csv'}
Show solution and explanation
files = {"/data/orders.csv", "/warehouse/menu"}
ms = {"orders": ("EXTERNAL", "/data/orders.csv"), "menu": ("MANAGED", "/warehouse/menu")}
def drop(t):
    kind, loc = ms.pop(t)
    if kind == "MANAGED":
        files.discard(loc)
drop("orders"); drop("menu")
print("tables:", ms, "files left:", files)
tables: {} files left: {'/data/orders.csv'}

How it works: Only the external table's file survives, the same rule Hive and Spark follow.

Real-world scenario questions (asked in company interviews)

Ecosystem questions test whether you know what each tool is for, and what is current.

Concepts · mapFresher

“Draw the Hadoop ecosystem”

A whiteboard question in most big-data interviews.

The interviewer is checking: layers and one purpose per tool.

Show a strong answer
  • Bottom: HDFS (or object storage); middle: YARN; top: engines (MapReduce, Tez, Spark) and SQL (Hive, Trino).
  • Side services: HBase for key lookups, ZooKeeper for coordination, Kafka for ingestion, Airflow for scheduling, Ranger for security.
  • Mention what changed: Sqoop and Oozie retired; Iceberg-style table formats are now common.
Design · storageExperienced

“Hive or HBase for our customer 360 view?”

The app needs one customer instantly; analysts need segments over all customers.

The interviewer is checking: access patterns.

Show a strong answer
  • Point reads by key with low latency → HBase (row key design, avoid hot spots).
  • Scans and aggregations → Parquet/Iceberg tables queried with Hive, Spark or Trino.
  • Feed both from the same pipeline; don't force one store to do both jobs.
Operations · migrationExperienced

Your cluster still runs Sqoop and Oozie

Both are retired. The manager asks what to do and how risky it is.

The interviewer is checking: awareness and a safe plan.

Show a strong answer
  • Retired means no releases or security fixes; vendors may still ship them for a while, but plan to leave.
  • Sqoop → Spark JDBC or CDC into Kafka; Oozie → Airflow DAGs calling the same jobs.
  • Migrate in waves with side-by-side runs and output comparison; retire the old ones last.
Internals · enginesFresher

“Does Hive still use MapReduce?”

A follow-up after you mention Hive.

The interviewer is checking: engines vs SQL layer.

Show a strong answer
  • Hive is a SQL layer; the execution engine is pluggable. Hive 4 encourages Tez; MapReduce was the original engine.
  • Whatever the engine, a GROUP BY becomes partial aggregation, a shuffle by key and a final aggregation.
  • Spark SQL showed exactly this in our EXPLAIN output.