Data quality scorecard · lakehouse recovery
On Databricks Free Edition, 7 of 12 repairs written blind restored a month of public trip data. Of the 5 that did not, totals on the published table alone wrongly cleared 2. Every check that also reads the cleaned table cleared none, but all 5 left that table's daily totals wrong, so these repairs cannot rank those checks; the bundle's zero holds by construction. The sender's totals are assumed right.
An independent author who never saw the checks wrote 12 SQL repairs, blind, for a late file, a renamed column and a bad backfill, and each ran on the platform as written. Per-day totals then judged each repair. Layer totals compare the landing, cleaned and published tables with each other, inside the platform; outside totals compare the published table, alone or with the cleaned table, against the counts and sums from the sender, whoever delivers the files. 2 of the 5 that failed fixed the published table and left the cleaned table wrong, so a check on the published table alone called them good: compare the cleaned table too. Layer totals alone are not enough either. They cleared a do-nothing repair on the late file, because a file nobody read is missing from every layer alike, and in the self-test only a row fingerprint caught fares joined by row position.
| Blind repairs that restored the data7 of 12row for row against a clean reference a team does not have; 2 of the author's 3 first choices | Wrong ones cleared, published table alone2 of 5the published numbers were right and the cleaned table was not | Wrong ones cleared, layer totals0 of 5a ceiling, since all 5 left the cleaned table wrong. Layer totals also cleared the do-nothing repair on the late file, failed 1 right repair that skipped the landing table, and knew the renamed column's new name | Predictions on the blind repairs that held2 of 4written before any repair ran, grouped after the results; 10 of 12 in all. The predictions expected more hurried repairs to fail, and layer totals to clear a wrong one. The rest, on controls, the self-test and the bundle, follow from how the test was built, and all held |
Main limitation 12 blind repairs from one author in one run and 10 self-test repairs, one fault of each kind, on 10,000 public trips. The counts describe these repairs, not a rate, and use the reference declared before the runs. That reference scores only the cleaned and published tables: one repair it counts as right left the late file out of the landing table, and only layer totals saw it. The bundle covers every column the reference compares, so its zero follows from its definition. The sender's totals come from the clean sample, so they are right by construction; a real sender can be wrong. The backfill instructions were ambiguous: on the author's reading, one blind backfill repair scored wrong would be right and one scored right would be wrong, and every comparison, the bundle included, gets both of those wrong. | |||
In plain words
When a data pipeline breaks, someone repairs it, and someone says it is fixed. The usual evidence is that the totals agree. This round asks which totals deserve that trust. It runs the same month of public trips through three tables on a real lakehouse platform, breaks the pipeline three ways, runs repairs, some right and some wrong, and scores each comparison against a clean copy kept only for the test. The data is public and the faults are synthetic, standing in for the incidents a data team meets, so no customer data is involved.
- Written blind
- By an independent author who never saw the checks, the sender's totals or the self-test repairs.
- Self-test repairs
- 10 repairs written with sight of the comparisons, to find where each one stops. They show what a comparison can miss, not how often a mistake happens.
- Sender
- Whoever delivers the files. Here its totals are computed from the clean sample.
- Do-nothing repair
- A repair that changes nothing, run on each fault as a control.
- Landing table (bronze)
- Every file as delivered.
- Cleaned table (silver)
- One row per trip, typed.
- Published table (gold)
- One row per day, the numbers people read.
- Layer totals
- Per-day counts and sums of one table against the next, all inside the platform.
- Outside totals
- The sender's per-day counts and sums, kept where no repair can touch them.
- Row fingerprint
- A per-day sum of a hash of each row, so a value that moves to another row changes it.
- The bundle
- Outside totals on both tables plus the row fingerprint. Together they cover every column the reference compares.
- False pass
- A comparison clears a repair, finding nothing wrong, and the data was not restored.
- Restore
- Putting a whole table back to an earlier version.
- Time travel
- Reading a table as it was at an earlier version, without changing it.
- Backfill
- Re-running past days through the pipeline.
Which totals can prove a repair
Each repair is scored twice. The reference says whether the data came back: the cleaned table and the published table equal a clean run, row for row, in both directions. A team has no such reference in an incident, so each comparison below is scored on whether it gives the same answer without one.
Wrong repairs passed. Counts, not rates; blind and self-test repairs are kept apart.
Blind repairsSelf-test repairs
Show the data
| Comparison | Blind: wrong repairs passed | Blind: right repairs failed | Self-test: wrong repairs passed | Self-test: right repairs failed |
|---|---|---|---|---|
| Outside totals, published table only | 2 of 5 | 0 of 7 | 3 of 6 | 0 of 4 |
| Layer totals | 0 of 5 | 1 of 7 | 1 of 6 | 0 of 4 |
| Outside totals, published and cleaned tables | 0 of 5 | 0 of 7 | 1 of 6 | 0 of 4 |
| Row fingerprint, cleaned table only | 0 of 5 | 0 of 7 | 1 of 6 | 0 of 4 |
| The bundle: outside totals on both, plus the fingerprint (zero by construction) | 0 of 5 | 0 of 7 | 0 of 6 | 0 of 4 |
| Fault | What the repair did | Kind | Data restored | Layer totals | Outside, published | Outside, both | Fingerprint |
|---|---|---|---|---|---|---|---|
| Late file | Load the late file into bronze, merge its trips into silver, and republish January 24. | Would run | Yes | Pass | Pass | Pass | Pass |
| Late file | Merge the late CSV directly into silver and refresh January 24 in gold. | In a hurry | Yes | Fail | Pass | Pass | Pass |
| Late file | Load the late file into bronze and rebuild January 24 gold totals from bronze. | In a hurry | No: published table right, cleaned table wrong | Fail | Pass | Fail | Fail |
| Late file | Append the late trips to bronze and silver, then refresh January 24 in gold. | In a hurry | Yes | Pass | Pass | Pass | Pass |
| Renamed column | Recover January 26 through 31 silver fares from bronze fare_amount and republish those dates. | Would run | Yes | Pass | Pass | Pass | Pass |
| Renamed column | Populate bronze fare from fare_amount, copy those fares to silver, and rebuild the affected gold dates. | In a hurry | Yes | Pass | Pass | Pass | Pass |
| Renamed column | Fill missing silver fares from trip_total less tips and additional charges, then refresh gold. | In a hurry | Yes | Pass | Pass | Pass | Pass |
| Renamed column | Recalculate the affected gold fare counts and sums directly from bronze fare_amount. | In a hurry | No: published table right, cleaned table wrong | Fail | Pass | Fail | Fail |
| Bad backfill | Restore January 22 fares from the pre-backfill silver version and republish that date while retaining the intended January 15 through 21 changes. | Would run | No | Fail | Fail | Fail | Fail |
| Bad backfill | Restore silver and gold to their versions immediately before the backfill. | In a hurry | No | Fail | Fail | Fail | Fail |
| Bad backfill | Replace January 15 through 22 in silver and gold with their pre-backfill contents. | In a hurry | Yes | Pass | Pass | Pass | Pass |
| Bad backfill | Rerun the fare backfill and gold aggregation with the intended January 15 through 21 bounds. | In a hurry | No | Fail | Fail | Fail | Fail |
1 result needs a note. One hurried repair merged the late file straight into the cleaned table and skipped the landing table. Both downstream tables came back, so it counts as restored, and layer totals failed it. The landing table stayed at 9,940 of 10,000 rows, so that alarm points at something real that the reference does not score.
Layer totals also knew the renamed column's new name, which the protocol fixed before the runs and a team checking a repair would know by then. A layer check written before the rename, reading only fare, would have passed the do-nothing repair on it, and failed 2 more right blind repairs, the ones that fixed only the cleaned and published tables. That follows from the check's SQL and was not run.
The self-test repairs
These were written with sight of the comparisons, to find where each one stops, so they are not evidence of how often a mistake happens.
| Fault | What the repair did | Kind | Data restored | Layer totals | Outside, published | Outside, both | Fingerprint |
|---|---|---|---|---|---|---|---|
| Late file | Load the late file, merge its rows into silver, restate January 24 from silver. | Right | Yes | Pass | Pass | Pass | Pass |
| Late file | Load and merge correctly, but add the late rows' totals to gold by an update that a retry runs twice. | Wrong | No | Fail | Fail | Fail | Pass |
| Late file | Add the late rows' totals to gold once, and never load them into bronze or silver. | Wrong | No | Fail | Pass | Fail | Fail |
| Renamed column | Merge the renamed days from bronze, reading fare_amount as fare, then restate those gold days. | Right | Yes | Pass | Pass | Pass | Pass |
| Renamed column | Fill the blank fares from the trip total, then restate those gold days. | Wrong | No | Fail | Fail | Fail | Fail |
| Renamed column | Fill the blank fares by joining silver to bronze on row position within the day, not on trip ID, then restate those gold days. | Wrong | No | Pass | Pass | Pass | Fail |
| Bad backfill | Merge the affected days back from bronze, then restate those gold days. | Right | Yes | Pass | Pass | Pass | Pass |
| Bad backfill | Restore silver and gold to the versions before the backfill, and stop there. | Wrong | No | Fail | Fail | Fail | Fail |
| Bad backfill | Recompute the affected gold days straight from bronze, and leave silver as the backfill left it. | Wrong | No | Fail | Pass | Fail | Fail |
| Bad backfill | Restore silver and gold to the versions before the backfill, then replay the four later mornings from bronze. | Right | Yes | Pass | Pass | Pass | Pass |
Two of them mark the edges. Joining fares by row position kept every daily sum, so every total agreed while 1,808 cleaned rows held another trip's fare, and only the fingerprint saw it. Adding the late totals twice left the cleaned table right, so the fingerprint passed while the published table was wrong. That is why the bundle takes both. The bundle's zero false passes follow from its definition, since it covers every column the reference compares; what this table measures is how much each cheaper comparison gives up.
One repair, traced
The renamed column. From January 26 the sender called the fare column fare_amount. With schema merge on, COPY INTO added the new column and raised no error. The job still read fare, so the cleaned table lost its fares on 2,035 rows that had one, and the published table showed six days of zero fares.
One hurried repair recalculated the published fares straight from the landing table:
MERGE INTO gold t USING (SELECT CAST(trip_date AS DATE) AS trip_date, count(CAST(fare_amount AS DECIMAL(18,6))) AS fares_present, CAST(coalesce(sum(CAST(fare_amount AS DECIMAL(18,6))), 0) AS DECIMAL(28,6)) AS fare_sum FROM bronze WHERE CAST(trip_date AS DATE) BETWEEN DATE'2024-01-26' AND DATE'2024-01-31' GROUP BY CAST(trip_date AS DATE)) s ON t.trip_date = s.trip_date WHEN MATCHED THEN UPDATE SET t.fares_present = s.fares_present, t.fare_sum = s.fare_sum
The published table came back row for row: 0 rows differ from the clean run. Outside totals on it pass. The cleaned table still had no fares on those 2,035 rows. Layer totals, outside totals on both tables and the fingerprint all fail, each naming the same six days. The morning job restates a day from the cleaned table, so running it again for those days would put the zeros back; that follows from the job's SQL and was not run.
What the platform did
- A restore goes back in time for the whole table.
RESTORE TABLEto the versions before the backfill undid it, and also the four good mornings after it: 1,201 cleaned rows and four published days gone. The landing table still held them. Every comparison failed it; the self-test restore and the author's did the same. - Time travel without a restore worked. One hurried repair replaced only January 15 to 22 in both tables, reading each table's version from before the backfill, and left the later days alone. It restored the data. So did the self-test repair that restored both tables and then replayed the four mornings from the landing table.
- With schema merge on, a rename raised no error. The load kept running with no fares, and nothing on the platform said so. Whether a load with schema merge off would have failed was not tested.
What the author read differently
The author's first choice on the backfill kept the new fares on January 15 to 21 and undid only the overrun onto January 22. The author's instructions said the job was meant for those days and never said its fare logic was wrong, so that is a fair reading; the gap is in the instructions. The author's summaries showed it before any repair ran, so a second reference was added then, the clean run with those fares kept, and the design said the page would report both. Against it, that repair is right, which makes the first choices 3 of 3 on that reading. Every comparison still fails it, because the sender's totals and the landing table hold the original fares. Totals tied to the source cannot bless a change the source never made: an intended restatement needs its own expected totals, written down before it runs.
The reading cuts both ways, and the other half was counted only after the results, in review. On that reading, the blind repair that put January 15 to 22 back is wrong, and so are both right self-test backfill repairs, and every comparison passes all three. Counted that way, totals on the published table alone pass 3 of the 5 wrong blind repairs, and every other comparison, the bundle included, passes 1. Every comparison fails 1 of the 7 right ones, the author's first choice, and layer totals fail 1 more, the repair that skipped the landing table. The headline keeps the reference declared before the runs.
What I would do with this
- Ask the sender for per-day totals, and keep them outside the platform. A count and key sums per day cost little. Only comparisons against the sender saw the file nobody read.
- Never close a repair on the published table alone. Compare the cleaned table against the same totals, or the next rebuild undoes the fix.
- Keep layer totals too. They flagged the repair that skipped the landing table, which the outside totals cannot see.
- Add a row fingerprint where values move between rows. It needs the sender to hash rows the same way, so I would start with the money columns.
- Use a restore for the moment, not the repair. Before a restore, list the good commits since that version and how they come back.
Predictions
Written before any repair ran. 10 of 12 held. After the results they were grouped by what they test: the 4 on the blind repairs, 8 to 11, could have failed, and 2 held. The others, on the clean reference, the do-nothing repairs, the self-test repairs and the bundle's definition, follow closely from how the test was built, and all held. Both misses were on the blind repairs: 4 of 9 hurried repairs failed, under the 5 predicted, and layer totals passed none of the wrong blind repairs.
- Held. On the clean reference, every comparison passes on every day. Band: 0 failures.
- Held. A do-nothing repair: on the late file, layer totals pass and the outside totals and fingerprint fail; on the renamed column and the backfill, all four fail. Band: exact.
- Held. The 4 right self-test repairs restore the data and pass every comparison. Band: 4 of 4.
- Held. Adding the late totals twice: the fingerprint passes, and layer totals and outside totals on the published table fail. Band: exact.
- Held. Repairing only the published table, on the late file and the backfill: outside totals on that table pass, and everything else fails. Band: exact.
- Held. The join by position: layer totals and both outside totals pass, and the fingerprint fails. Band: exact.
- Held. Taking the trip total as the fare, and the restore alone: all four comparisons fail. Band: exact.
- Held. The repair the author would run restores the data on at least 2 of the 3 faults. Band: 2 to 3.
- Missed. Of the 9 hurried blind repairs, at least 5 do not restore the data. Band: 5 to 9.
- Missed. Layer totals pass at least 1 wrong blind repair. Band: 1 to 5.
- Held. Outside totals on the published table pass more wrong blind repairs than outside totals on both tables. Band: strictly more.
- Held. The bundle has 0 false passes and 0 false alarms on the blind repairs; this follows from its definition unless a sum differs by under 0.01. Band: 0 and 0.
Limits
- The faults are ported from this study's pipeline recovery part, so this round says nothing new about catching faults. New here are the platform, the blind repairs and the scoring of the totals.
- The zeros for the checks that read the cleaned table rest on 5 wrong blind repairs from one author in one run, and every one of them left that table's daily totals off the sender's. They mean these repairs did not get past those comparisons, not that a wrong repair cannot: the self-test join by position got past every total.
- The reference ignores the landing table and every lineage column, and it covers the 12 trip columns and the 7 published columns only.
- SQL warehouse only, on a free tier, with 10,000 rows. No Spark jobs, no Lakeflow or streaming tables, and nothing about speed, cost or scale at volume. Late data arrives as files, so streaming recovery is not tested.
- The author wrote without being able to run anything, so it could not test and correct a repair as an engineer would. All its statements still ran without an error.
Use this at your company
To test the control totals of a pipeline of your own the same way, paste this prompt into an AI assistant that can query your warehouse.
This method comes from Diogo Travassos's study "Data quality scorecard: lakehouse recovery" (https://diogotravassos.dev/data-quality-scorecard/lakehouse-recovery.html). If you can open links, read it first: it works the method through end to end and shows the checks that caught mistakes. The steps below stand on their own if you can't. Help me find out whether our control totals can prove that a data repair worked, before we trust the next one. Data you need from me: the landing table, the cleaned table keyed on a row ID, the published daily table, the sender's own per-day totals if they send any, and the SQL we ran for our last few repairs. Method: 1. Get per-day totals from outside the platform: row counts and key sums from the sender, or computed from the delivered files before loading them. Keep them where no repair can touch them. Add a per-day sum of row hashes over every column that matters. 2. On a copy, plant one fault of each kind: a late file no job reads, a renamed source column that loads without an error, and a backfill that rewrites too many days and is followed by good loads. 3. Have someone who has not seen the totals write four repairs per fault: the one they would run, and three a capable person in a hurry might run. Run them as written, restoring the tables before each. 4. After each repair compare, per day: landing against cleaned against published; outside totals against published alone; outside totals against both; and the row hashes against the cleaned table. Checks before trusting the answer: - Score each comparison against a clean reference build, row for row, in both directions. A team does not have that reference in an incident, so it is only for this test. - Run a repair that does nothing on each fault, and record which comparisons pass it. - Include one repair that keeps every daily sum but moves values between rows, and confirm which comparison catches it. Report back: per comparison, how many wrong repairs it passed and how many right repairs it failed, which repairs fixed the published table but not the cleaned one, and the limits: how many repairs, from how many authors, and whether the sender's totals are themselves right. In your report, say which study you followed and link it: https://diogotravassos.dev/data-quality-scorecard/lakehouse-recovery.html
Method and checks
Data and pipeline
The study's sealed sample, the first 10,000 City of Chicago trips of January 2024 by trip ID, hash checked, with hashed trip IDs and no coordinates, uploaded as one CSV file a day to a Unity Catalog volume. The landing table loads with COPY INTO and schema merge on, as text. The cleaned table merges each file on trip ID. The published table replaces that day with INSERT INTO ... REPLACE WHERE. January 1 to 20 load as one job and January 21 to 31 one file a morning. Each fault has its own schema, and a clean reference has another.
Comparisons and scoring
Counts match exactly; sums within 0.01. Layer totals read the landing table as its latest row per trip ID, taking fare or fare_amount. Outside totals are computed from the sealed sample, outside the platform, where no repair can reach them. The fingerprint is the per-day sum of the first 12 hex digits of a SHA-256 over all 12 trip columns. On the clean reference the platform's fingerprint equals the one computed outside on every day. The reference comparison uses EXCEPT ALL in both directions.
Runs
Before each attempt the three tables are restored to the fault state's versions and their row counts compared with it. One run per repair, since SQL on fixed data has no randomness. The first right repair on each fault ran a second time at the end of its fault, and all 3 matched. A do-nothing repair ran on each fault as the positive control. All 12 blind repairs and all 10 self-test repairs finished, so no platform error is scored as a wrong repair. Tools: the platform's SQL Statement Execution API and Files API.
Who wrote the repairs
The author is independent of the totals: given the pipeline's SQL and the three incidents, it never saw the comparisons, the sender's totals or the self-test repairs. It wrote once, and its statements ran literally, with only the landing folder and two table versions filled in. The author did not grade anything: scoring is mechanical. Its instructions are kept out of these downloads, so that step cannot be re-run from them alone; its repairs are published as written.
Decided before the runs, and what changed
The faults, the self-test repairs, the comparisons, scoring, predictions and headline rule were committed before any fault or repair ran. Development ran only on a tiny synthetic table and on the clean reference. The second reference for the backfill, described above, was added after the author's summaries were read and before any repair ran; the design records it. The design and protocol call a false pass a false proof. The section on what the platform did, the note on the landing table and the advice were written after the results. So were these, in review: the full count against the second reference, the grouping of the predictions by what they test, and the note on the renamed column's name. And these, in a second review: the count of days on which each wrong blind repair left the cleaned table's totals off the sender's, the limits now beside the headline's zeros, the bundle's label and the wording that makes the method the subject. No comparison, prediction or outcome changed.
Rebuild it
The results rebuild from the stored records with no key: python -B -m quality.lakehouse_summary, and the tests pin them. A new run needs a Databricks workspace of your own.
The scorecardPipeline recoveryDesignProtocolBlind repairsResultsRecordsReproduce it