跪拜 Guibai
← All articles
Backend · Big Data · Database

Database, warehouse, lake, middle platform, lakehouse: one e-commerce order chain explains all five and why lakehouse isn't 'lake plus warehouse'

By Rain的Java大神之路 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

The practical cost of confusing these five concepts is real: teams copy data between lake and warehouse, double-maintain stream and batch pipelines, and still can't reconcile GMV numbers. This guide gives a shared vocabulary plus actionable table-format choices so Western data engineers can avoid building another expensive reporting platform that nobody reuses.

Summary

The article walks through a single e-commerce order placement to define five overlapping data concepts: MySQL handles the OLTP transaction, Flink CDC streams Binlog into object storage as a data lake, Spark and Flink clean it into a data warehouse, Iceberg/Hudi/Paimon tables unify stream and batch on one copy of data as lakehouse, and a data middle platform turns GMV, active users and risk labels into shared APIs. The five are layered collaborators, not replacements.

Selection guidance is concrete: Iceberg for multi-engine shared PB-scale analysis with strong schema evolution, Hudi for Spark-heavy high-frequency Upsert and CDC, Paimon for Flink real-time primary-key tables with Changelog, and Delta Lake inside Databricks ecosystems. Real-world numbers are version-dependent; Paimon hits roughly 1-3 second end-to-end latency at ten-thousand-level TPS, while Iceberg stream writes take seconds to tens of seconds.

The last sections cover the pitfalls that actually bite: small-file avalanches, metadata bloat, concurrent write conflicts, CDC ordering, stream-batch metric mismatches, schema changes breaking downstream, data skew, backpressure, and governance that turns a lake into a swamp. Solutions include rewrite_data_files, snapshot expiration, compaction triggers, unified event time and primary keys, and layer-separated reconciliation with T+1 automatic checks.

Takeaways
— Database, data warehouse, data lake, data middle platform and lakehouse solve different problems; they operate in layers rather than replacing one another. Database manages transactions, warehouse manages analysis conventions, lake manages raw storage, middle platform manages asset reuse, lakehouse provides warehouse capabilities on lake storage.
— Lakehouse unifies storage and table format, not necessarily the query engine. ClickHouse or Doris can still serve as acceleration layers for sub-second, high-SLA reports.
— Analysis queries should never run directly against the transaction primary database. Use read replicas, CDC ingestion, or separate analytical stores; index design like putting equality columns before sort columns reduces filesort.
— Data warehouse layering (ODS/DWD/DWS/ADS) decouples ingestion, common processing and scenario applications. Metric conventions should be defined once in DWS, not scattered across report SQLs.
— A bare data lake with no catalog, owner, quality rules and lineage quickly becomes a data swamp. Tools like Atlas and DataHub do not replace governance responsibility.
— The data middle platform's core is OneData (unified metrics), OneID (unified entity identity) and OneService (unified API/indicator/tag delivery). Many middle platform projects fail because no one pays for reuse; start with a genuinely reused metric as a pilot.
— The real enabler of lakehouse is the table format, not object storage. Iceberg, Hudi, Paimon and Delta Lake add ACID, Upsert, schema evolution, snapshot isolation, time travel and incremental reads on top of Parquet files.
— Iceberg schema evolution is field-ID based, so adding or renaming columns changes only metadata without rewriting historical data. Breaking changes like int → string require new columns, dual-write and backfill.
— End-to-end Exactly-Once in Flink CDC requires coordination among source snapshot, checkpoint, and sink two-phase commit or idempotent writes; simply enabling checkpointing is not enough.
— For incremental CDC joins, use a captured snapshot ID and FOR SYSTEM_TIME AS OF so old orders join the dimension version valid at their business time, not the latest profile.
— Paimon's Partial Update merge engine lets order and risk streams update different fields of the same user wide table, reducing Flink join state pressure significantly.
— Small files need both source control (target file size 256-512MB, reasonable checkpoint interval) and background compaction (rewrite_data_files, clustering, compaction). Snapshot expiration and manifest rewrite prevent metadata bloat.
— Real-time vs offline metric differences of a few percent usually come from three places: different metric semantics, different time semantics (event vs processing), and different deduplication strategies. Fixing requires a single definition layer, unified keys, and T+1 automatic reconciliation with alerting.
— When exposing a unified query/API gateway for multiple engines, route by scene behind a strategy interface, and enforce metric registry, access control, masking, cache and rate limiting before any engine executes. Never concatenate caller-supplied SQL.
— For a 30-second interview answer: five concepts are layered collaboration, not substitution; follow-up specifics include lakehouse not replacing OLAP accelerators, middle platform being about reuse not a database, and time travel being immutable files plus metadata snapshots.
Conclusions

Paimon's Partial Update turns a classic Flink join state problem into a storage-level merge, which is a genuinely different architectural trade-off: it trades write amplification and storage complexity for reduced state size and simpler stream topology.

The article's repeated warning that benchmark numbers (Paimon's 1-3s, Iceberg's seconds) depend heavily on version and configuration is the right kind of honesty; blindly quoting such figures in a technical review can sink a real selection.

The 'middle platform is a pseudo-concept' debate is sidestepped by defining it as a governance and reuse mechanism rather than a technology; the failure mode the article names - building a company-wide platform before any pilot demand - matches the common death of such initiatives in the West.

The engineering pitfalls table is the most reusable part: it maps each symptom (small files, stream-batch mismatch, schema breakage) to a concrete root cause and a concrete tool or process, which is more valuable than the conceptual taxonomy.

The emphasis on 'compatible vs breaking schema changes' is a point many Spark/Flink tutorials omit; expecting the table format to handle semantic changes like int to string is a common production mistake.

Concepts & terms
Lakehouse (湖仓一体)
An architecture that uses open table formats (Iceberg, Hudi, Paimon, Delta Lake) on top of low-cost object storage or HDFS to provide data warehouse features like ACID transactions, Upsert, schema evolution and time travel on a single copy of data, eliminating the need to copy data between a lake and a warehouse.
Data middle platform (数据中台)
A governance and service layer, not a specific database, that unifies metrics, entity IDs and data access (OneData, OneID, OneService) so multiple business lines reuse the same indicators, labels and APIs instead of building their own.
Open table format (开放表格式)
A metadata and file organization layer (Iceberg, Hudi, Paimon, Delta Lake) that turns a collection of Parquet/ORC files on object storage into a queryable table with transactions, consistent snapshots, incremental reads and multi-engine support.
Schema-on-Read vs Schema-on-Write
Schema-on-Write enforces a schema when data is written (typical of databases and warehouses); Schema-on-Read lets you interpret raw files flexibly at query time (typical of data lakes). Lakehouse balances both via table formats that allow evolution.
CDC (Change Data Capture)
A technique to capture row-level changes (inserts, updates, deletes) in a source database, typically from MySQL Binlog, and stream them to downstream systems like Kafka, Flink, or a lakehouse table for real-time analytics.
Partial Update (Paimon merge engine)
A Paimon merge engine that merges multiple input streams by primary key, only updating the fields each stream provides, enabling wide-table construction without a full Flink join state.
CoW vs MoR (Hudi table types)
Copy-on-Write rewrites data files on every update, favoring read performance; Merge-on-Read writes changes to a log and merges at read time, favoring write performance for low-latency CDC.
Zero-ETL
In lakehouse context, querying data in place across engines without copying it into a separate store; ETL for cleaning and modeling still exists, but data is not moved just for querying.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗