At a glance
- Challenge: every shipment record holds the carrier, the promised date and the delivery time, but nobody can say which carrier keeps its promise without pasting tens of thousands of rows together in a spreadsheet.
- Solution: one visual DataFloem job reads the shipments where they are, keeps the delivered parcels, flags the late ones and writes one row per carrier to Apache Iceberg.
- Value: the late rate, volume and delivery time of every carrier side by side, rebuilt on every run and ready for the next carrier negotiation.
The scenario
Synthetic data. ShopFlow is a fictional online store, and the carriers are fictional too.
Every online order comes with a promise: the delivery date the customer saw at checkout. When a parcel arrives late, the customer blames the store, not the carrier. So ShopFlow's operations team keeps asking the same question: which carrier keeps its promise, and which one doesn't?
ShopFlow ships 18,890 parcels with six carriers: SwiftCargo, BlueCargo, AnatoliaExpress, ParcelGo, ExpressNet and NorthLogistics. The answer is already in the data. What is missing is a reliable way to turn those rows into one clear number per carrier, every time new shipments come in.
Why the answer is not a simple count
- Not every parcel can be judged. A parcel still on the way has no delivery time yet, and a lost one never will.
- A date against a time stamp. The promise is a date, while the delivery is a moment in time. A parcel delivered late in the evening of its promised day is on time for the customer.
- Rebuilt, not pasted. The numbers per carrier have to be rebuilt every time new shipments arrive, not put together once in a spreadsheet.
The data source
The shipments live in the store's PostgreSQL database, hosted on
Supabase, in shopflow.shipments:
| Column | What it holds |
|---|---|
carrier |
The carrier that took the parcel |
warehouse |
The warehouse it left from |
shipped_ts |
When the parcel was shipped |
promised_date |
The delivery date the customer was promised |
delivered_ts |
When it was actually delivered (empty if not yet) |
status |
delivered, in_transit or
lost
|
DataFloem reads the table where it already is. No export, no staging database, no custom script.
Building the job in DataFloem
The whole job is sketched on the canvas first, the way you would draw it on a whiteboard, and then each step gets its settings. Its flow has six nodes:
-
Read the shipments. The source node connects to
PostgreSQL and reads
shopflow.shipments. DataFloem reads the table's columns itself, so every later step can pick them from a list. -
Keep only delivered parcels. Parcels that are in
transit or lost can't be judged yet. A Filter node
keeps the rows where
statusequalsdelivered. -
Flag late deliveries. An
Expression node adds two columns, written in Spark
SQL.
is_lateis 1 when the parcel arrived after its promised date and 0 when it was on time:CASE WHEN to_date(delivered_ts) > promised_date THEN 1 ELSE 0 ENDdelivery_daysis the time from shipping to delivery, in days:Comparing the delivery date with the promised date means a parcel delivered late in the evening of its promised day still counts as on time, just as the customer would see it.(unix_timestamp(delivered_ts) - unix_timestamp(shipped_ts)) / 86400.0 -
One row per carrier. An
Aggregation node groups the parcels by
carrierand calculates three values: the count ofshipment_id, the delivered shipments; the average ofis_late, which is simply the late rate, since the flag is 1 for late and 0 for on time; and the average ofdelivery_days, the average delivery time. -
Name the columns for people. The aggregation names
its outputs after the function, like
cnt_shipment_idandavg_is_late. A Select node renames them todelivered_shipmentsandlate_rate, so the report reads like a report. -
Test, then write to the lakehouse. The target is an
Apache Iceberg table,
shopflow_lakehouse.delivery_sla.carrier_sla, with the Overwrite strategy: every run replaces the report, so there are never any duplicates. Before the real run, a Partial Run tests every step on the Spark cluster. Each step turns green when it succeeds, and Data Preview shows the result before anything is written: six rows, one per carrier. Then the full run writes the table.
The result: one query, a clear answer
With the report in the lakehouse, one SQL query sorted by late rate answers the question:
SELECT *
FROM shopflow_lakehouse.delivery_sla.carrier_sla
ORDER BY late_rate DESC
| Carrier | Delivered shipments | Late rate | Avg. delivery time |
|---|---|---|---|
| NorthLogistics | 3,005 | 48% | 2.9 days |
| AnatoliaExpress | 3,197 | 21% | 2.4 days |
| ParcelGo | 3,114 | 17% | 2.3 days |
| BlueCargo | 4,626 | 16% | 2.2 days |
| ExpressNet | 1,560 | 12% | 2.1 days |
| SwiftCargo | 3,121 | 8% | 1.9 days |
Across 18,623 delivered parcels, about one in five arrived after its promised date. But the average hides the real story. NorthLogistics misses almost half of its promised dates, while SwiftCargo is late only eight percent of the time, and is also a full day faster. That is no longer a feeling from customer complaints; it is a number the team can take into the next carrier negotiation.
Architecture
What this demo does not claim
- No carrier API or tracking integration. The shipments are read from the store's own database.
- No real-time alerting. The job runs as a batch and overwrites the report.
- No root-cause analysis. The report shows which carrier is late, not why.
- All data is synthetic.
What it means for an online store
| Before | With DataFloem |
|---|---|
| A feeling from customer complaints | A late rate, volume and delivery time per carrier |
| In-transit and lost parcels mixed into the count | Only parcels that can be judged are counted |
| Lateness measured to the hour | Lateness measured against the date the customer saw |
| A spreadsheet put together once | A report rebuilt on every run |
| Numbers locked in one file | An Iceberg table any SQL tool or dashboard can read |
The same pattern works for any promise your business makes: warehouse dispatch times, return processing, supplier lead times or support response times. Connect the system that already holds the records, flag what missed the target, aggregate it by who is responsible, and publish a clean table your teams can query.
The DataFloem capabilities it uses
| Capability | Role in this use case |
|---|---|
| Data integration | The shipments read in place from PostgreSQL |
| Data processing | Filter, Expression, Aggregation, Select and catalog target nodes on a visual canvas |
| Spark SQL expressions | The late flag and the delivery time in days |
| Partial Run and Data Preview | The six carrier rows checked before anything is written |
| Apache Iceberg catalog |
The carrier_sla report, overwritten every run
|
| SQL Queries | The answer, on the same platform |
See it in action
The video below follows the same job on the DataFloem canvas, from the raw shipments in PostgreSQL to the SQL query that names the late carrier.
| Time | What you see |
|---|---|
| Which carrier keeps its promise? | |
| A new job: the whole pipeline at a glance | |
| Reading shipments from PostgreSQL | |
| Only delivered parcels | |
| Flagging late deliveries with Spark SQL | |
| Grouping by carrier: the late rate as an average | |
| Clean column names for the report | |
| Writing to an Apache Iceberg table | |
| Partial run and Data Preview | |
| Full run and SQL: who is late? |