Metric definitions drift
When batch reports and streaming dashboards are implemented independently, GMV, order counts, and refunds can diverge because of filters or date boundaries.
The same e-commerce metrics are produced through a Doris batch warehouse and a Flink SQL streaming chain. Streaming outputs are materialized to both Paimon layers and Doris ADS, then reconciled field by field in Doris.
Batch processing prioritizes stable recomputation and historical definitions; streaming prioritizes continuous updates and low-latency dashboards. The difficult part is not running two systems—it is keeping business definitions consistent and making the results explainable and reproducibly verifiable.
When batch reports and streaming dashboards are implemented independently, GMV, order counts, and refunds can diverge because of filters or date boundaries.
Doris provides OLAP serving and the unified ADS endpoint; Paimon stores ODS/DWD/DWS/ADS results materialized from the same streaming DAG.
The implementation stays focused on MySQL, Doris, Kafka, Flink, and Paimon so the local dual-path run and field-level reconciliation remain the primary evidence.
The batch path loads a MySQL source into Doris and transforms it through physical layers. The streaming path consumes Kafka events in Flink SQL, expresses DWD → DWS → ADS as temporary views, and uses one Statement Set to write Paimon layers and Doris ADS in parallel. Offline and real-time ADS are then reconciled in Doris.
MySQL data is loaded into Doris ODS/DIM and transformed through DWD, DWS, and ADS with Doris SQL.
Kafka events enter a Flink SQL temporary-view DAG; a Statement Set materializes ODS/DWD/DWS/ADS and Doris ADS as parallel sinks.
Outputs align at dt + recent_days granularity and compare GMV, distinct orders/users, refunds, and average order value field by field.
MySQL represents the commerce source system. Scripts load ODS and DIM tables into Doris, where SQL standardizes DWD details, aggregates fixed reporting windows in DWS, and produces ADS metrics.
Deterministic Kafka events feed the streaming path. Flink SQL temporary views form the DWD, DWS, and ADS logic chain; multiple inserts in one Statement Set materialize Paimon ODS/DWD/DWS/ADS and the final Doris ADS output in parallel. Downstream logic does not read Paimon physical tables layer by layer in this job.
Both paths output at dt + recent_days granularity. Core metrics include GMV, distinct orders, distinct buyers, refund orders, refund users, and average order value. The business date is fixed at 2026-07-01; recent_days represents deterministic reporting windows, not a Flink Window TVF.
| recent_days | GMV | Orders | Buyers | Refunds | Refund Users | Avg. Order Value |
|---|---|---|---|---|---|---|
| 1 | 505.50 | 5 | 4 | 2 | 2 | 101.10 |
| 7 | 1078.50 | 9 | 6 | 3 | 3 | 119.83 |
| 30 | 1578.50 | 10 | 7 | 4 | 4 | 157.85 |
Validation goes beyond checking that both tables contain rows. A single Doris query aligns offline ADS and realtime ADS by dt + recent_days, then compares every metric field. All three fixed windows pass under the same sample data and contract.
Both batch and streaming ADS outputs land in Doris, so BI queries and demonstrations use one OLAP layer and can directly reconcile the two paths.
Temporary views express DWD → DWS → ADS dependencies. Paimon layers and Doris ADS are parallel materialization targets used for inspection, retention, and serving.
A generic JDBC sink encountered compatibility issues with the Doris MySQL protocol and ON DUPLICATE KEY, so the project uses the Doris Flink Connector and Stream Load.
The Kafka topic is reset before sample events are written, preventing duplicated events from inflating streaming GMV and keeping reconciliation stable.
The first version runs on Docker Desktop + WSL2. After MySQL, Doris, Kafka, and Flink start, the scripted sequence reproduces the complete flow.
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\validate-repo.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\run-demo.ps1 -Reset
This version proves the dual-path metric contract and the local reproduction loop without presenting planned enhancements as delivered capabilities.
I can implement one e-commerce metric contract through a Doris batch warehouse and a Flink SQL streaming chain, materialize Paimon layers and Doris ADS in parallel with a Statement Set, reconcile results field by field in Doris, and state the limits of a local MVP precisely.