Apache Hudi

Also known as: Hudi

On this page 7

Apache Hudi is an open table format and data lake platform that adds record-level upserts, deletes and incremental processing to collections of files stored in cloud object storage or HDFS. Among modern data formats, Hudi sits one layer above file formats such as Parquet and Apache Avro: it does not replace them but organizes them into transactional tables with a commit history, indexes and table services.

The name stands for Hadoop Upserts Deletes and Incrementals. Hudi was created at Uber in 2016 to keep large analytical tables fresh within minutes instead of hours, and it became a top-level project of the Apache Software Foundation in 2020. It is usually compared with Apache Iceberg and Delta Lake, the other two widely used lakehouse table formats.

How Apache Hudi organizes files into tables

Hudi turns a directory of data files into a table by maintaining a timeline of actions in a hidden metadata folder. Every write, compaction, clean or rollback is recorded as an instant with a timestamp and a state (requested, inflight or completed), and readers only see data from completed instants. This timeline provides atomic commits and snapshot isolation without a separate database server.

Data is grouped into partitions and, inside each partition, into file groups. A file group is identified by a file ID and contains successive file slices; each slice holds a base file (normally Parquet) and, for some table types, log files (normally Avro) with later changes. Because every record key maps to exactly one file group, Hudi can locate and rewrite the right file during an update instead of scanning the whole table.

The main building blocks and their roles are summarized below.

ComponentWhat it storesPurpose
TimelineInstants with action type and stateAtomic commits, rollback, time travel
Record keyUnique key per recordIdentifies rows for upserts and deletes
Partition pathDirectory derived from a fieldPrunes data during queries
File groupBase files and log files per file IDUnit of update and versioning
Metadata tableFile listings, column statistics, indexesAvoids slow object store listings
Precombine fieldOrdering value such as a timestampPicks the latest version of duplicates
Core components of a Hudi table

Copy-on-write and merge-on-read table types

Hudi offers two table types that trade write cost against read cost. In copy-on-write (CoW), every update rewrites the affected Parquet base file, so reads are fast and simple but writes amplify. In merge-on-read (MoR), updates are appended to row-based log files and merged with base files either at query time or later by compaction, which keeps ingestion latency low.

The choice depends on the update rate and on how readers query the table.

PropertyCopy-on-writeMerge-on-read
Update mechanismRewrite whole base fileAppend to log files
Write latencyHigherLower
Write amplificationHigh for scattered updatesLow until compaction
Snapshot read costLowest, pure ParquetHigher, merges logs on read
Read-optimized viewSame as snapshotBase files only, possibly stale
Typical workloadBatch updates, read-heavy analyticsStreaming ingestion, frequent updates
Comparison of Hudi table types

A MoR table exposes three query types: a snapshot query that merges logs for the freshest data, a read-optimized query that reads only compacted base files, and an incremental query that returns only records changed after a given instant. The incremental query is the feature that most clearly distinguishes Hudi from plain file formats.

Indexing, incremental queries and table services

To apply an upsert, Hudi must know which file group already contains each incoming key, and it uses an index for this lookup. Options include Bloom filter indexes stored in file footers, simple indexes that join against existing keys, bucket indexes that hash keys into a fixed number of buckets, and a record-level index kept in the metadata table. Choosing the wrong index is a common cause of slow upserts on large tables.

Hudi also runs table services that keep the layout healthy over time: compaction merges log files into new base files, clustering rewrites small files and sorts data for better pruning, and cleaning removes file slices older than the retention policy. These services can run inline with each write or asynchronously in separate jobs.

Index typeLookup methodBest suited for
Bloom indexProbabilistic key filters per fileKeys with time ordering, late updates rare
Simple indexJoin incoming keys with stored keysRandom updates on moderate tables
Bucket indexHash of key to fixed bucketVery high write throughput
Record-level indexKey to file mapping in metadata tableLarge tables with random upserts
Index types and when they fit

Apache Hudi compared with Iceberg and Delta Lake

All three open table formats provide ACID transactions, schema evolution and time travel over Parquet files, so the differences lie in emphasis. Hudi was designed first for record-level mutation and incremental pipelines, Apache Iceberg for engine-neutral analytics on very large tables, and Delta Lake for tight integration with Apache Spark. Interoperability projects such as Apache XTable can expose one table through the metadata of another format, which reduces lock-in.

AspectApache HudiApache IcebergDelta Lake
Original focusUpserts and incremental ingestionLarge-scale analytic tablesReliable Spark tables
Update strategyCoW or MoR per tableCopy-on-write or delete filesCopy-on-write or deletion vectors
Built-in indexingSeveral index typesStatistics, no key indexStatistics, no key index
Change feedNative incremental queriesIncremental scans between snapshotsChange data feed
Bundled table servicesCompaction, clustering, cleaningMostly external proceduresOPTIMIZE and VACUUM
Hudi, Iceberg and Delta Lake at a glance

When to choose Apache Hudi and common pitfalls

Hudi fits best when a lake table must absorb frequent updates and deletes, for example change data capture from operational databases, GDPR erasure requests or late-arriving events. Its DeltaStreamer utility, now called Hudi Streamer, ingests from Kafka or database logs with little custom code. For mostly append-only data with many query engines, Iceberg or plain Parquet may be simpler.

Most production problems come from configuration rather than the format itself.

SymptomLikely causeRemedy
Slow upsertsBloom index on random keysSwitch to bucket or record-level index
Many tiny filesSmall commits without clusteringEnable clustering and file sizing
Stale MoR readsCompaction lagging behind ingestionSchedule asynchronous compaction
Storage growthRetention set too longTune cleaner commits retained
Duplicate recordsWrong record key or precombine fieldRedefine keys and rewrite table
Typical mistakes with Hudi tables

Hudi also has a steeper learning curve than its alternatives because it exposes many tuning options. Teams should treat the record key, partition path and index as long-term design decisions, since changing them later usually means rewriting the table.

In simple terms

Imagine a huge archive of folders where you can normally only add new pages. Correcting a single line would mean finding and reprinting a whole folder by hand. Apache Hudi acts like a careful archive clerk with an index card system: it knows which folder holds each record, keeps a dated log of every change, and lets you ask what changed since yesterday.

The data still lives in ordinary files, but Hudi adds the bookkeeping. The key takeaway is that Hudi lets a cheap file store behave like an updatable table.

A practical example

A regional ride-sharing operator stores about two billion trip records in cloud object storage. Trips are updated after completion when fares, tips and ratings arrive, often hours later. The data team captures changes from its PostgreSQL database with a change data capture tool, publishes them to Kafka, and uses Hudi Streamer to upsert them into a merge-on-read table partitioned by trip date, with a record-level index on the trip ID.

New changes become queryable within about five minutes, while asynchronous compaction runs every hour. Downstream finance jobs use incremental queries to read only the trips changed since their last run instead of rescanning the full history. The result is that nightly reprocessing of entire partitions disappears and compute costs for the reporting pipeline drop substantially.