Enterprise Cloud Architecture, Zero Trust Cybersecurity, LLMOps & High-Scale Systems

Data Engineering

Streaming Lakehouse with Apache Flink and Apache Hudi: ACID Transactions on Object Storage

November 23, 2026 ยท By writer

Modern data lakehouses have eliminated the historic bifurcation between fast operational streaming and large-scale analytical query processing. While Apache Kafka provides excellent real-time event streaming, long-term analytical queries over historical data require columnar formats (Parquet) stored on inexpensive cloud object storage (Amazon S3, Google Cloud Storage). Apache Hudi paired with Apache Flink delivers streaming ingestion with continuous sub-minute commits, enabling ACID upserts, point-in-time time travel, and low-latency incremental reads directly over raw cloud object lakes.

Hudi Table Types: Copy-on-Write (COW) vs Merge-on-Read (MOR)

Selecting between Hudi storage layouts dictates write amplification and read performance characteristics:

Storage ArchitectureWrite Ingestion BehaviorQuery LatencyPrimary Target Workload
Copy-on-Write (COW)Rewrites entire Parquet files on upsertMaximum (Pure columnar scan)Read-heavy tables, slow update cadences
Merge-on-Read (MOR)Appends updates to fast Avro delta log filesModerate (Merges log + base Parquet on read)Streaming ingest, high-frequency updates, CDC

Flink SQL Real-Time Streaming Ingestion into Apache Hudi

Below is a production Flink SQL pipeline consuming from an event broker and writing ACID upserts to an Apache Hudi table on Amazon S3:

-- Flink SQL Streaming Table Definition
CREATE TABLE hudi_customer_orders (
    order_id      STRING PRIMARY KEY NOT ENFORCED,
    customer_id   STRING,
    total_amount  DOUBLE,
    status        STRING,
    ts            TIMESTAMP(3),
    WATERMARK FOR ts AS ts - INTERVAL '5' SECOND
) WITH (
    'connector' = 'hudi',
    'path' = 's3a://enterprise-data-lakehouse/orders/',
    'table.type' = 'MERGE_ON_READ',
    'write.precombine.field' = 'ts',
    'write.insert.drop.duplicates' = 'true',
    'write.rate.limit' = '5000',
    'compaction.async.enabled' = 'true',
    'compaction.trigger.strategy' = 'num_commits',
    'compaction.delta_commits' = '5',
    'hive_sync.enable' = 'true',
    'hive_sync.mode' = 'hms',
    'hive_sync.db' = 'lakehouse_db',
    'hive_sync.table' = 'customer_orders'
);

-- Continuous Streaming Upsert Query
INSERT INTO hudi_customer_orders
SELECT 
    order_id, 
    customer_id, 
    total_amount, 
    status, 
    event_timestamp
FROM kafka_orders_stream;
  • Asynchronous Background Compaction: In Merge-on-Read tables, configure background compaction threads to merge small Avro delta logs into clean Parquet files without blocking real-time write streams.
  • Record Key Precombining: Always specify a timestamp precombine field (write.precombine.field) so Hudi automatically retains the latest mutation when receiving out-of-order records.
  • Metadata Index Acceleration: Enable Hudi’s internal Bloom filter and record-level index to eliminate expensive object store list operations during record lookups.
๐Ÿท๏ธ Topics: