Production Pipeline Debugging Challenge
A production revenue pipeline ran without throwing runtime errors, but the CFO dashboard was halted by the automated reconciliation audit: revenue is inflated by +34%, customer counts are wrong, and orders are mysteriously missing. Your job is to investigate the code, find the 5 defects, fix them, and prove zero variance.
Mission & Incident Context
Understand why this silent failure occurred and what the business impact is.
The Silent Failure Nightmare
The most dangerous bugs in data engineering are not crashes or syntax exceptions—they are silent logic errors where a pipeline finishes with exit code 0, but produces corrupt numbers.
Last night, the automated daily sales job ran in Databricks. When the downstream financial reconciliation check triggered at 04:15 UTC, it raised an immediate critical alert: the Gold table revenue did not match the audited source transactions. The CFO board dashboard is currently blank because the release gate halted publication.
Starter Materials & Broken Code
Inspect the broken PySpark script, input CSVs, and the automated audit failure log.
Hands-On Debugging Workflow
Follow the professional Data Engineering incident troubleshooting lifecycle.
Reproduce the Error Locally
Run the broken pipeline with the provided orders_sample.csv and promotions_sample.csv.
Diagnose Defect 1 — Join Multiplication
Investigate why the row count increases after joining promotions_df.
Diagnose Defect 2 — Silent Null Dropping
Investigate why orders ORD-902 and ORD-906 vanished from the final output.
Diagnose Defect 3 — Data Types & String Concatenation
Check the schema of total_billed = order_amount + shipping_fee.
Diagnose Defect 4 & 5 — Aggregation & Hardcoded Dates
Correct customer metric counting and date windowing.
Expected Output & Reconciled Metrics
Your repaired pipeline must produce this exact financial baseline.
Target Reconciled Metrics
Expected Reconciled Store Output (2024-03-10)
| order_date | store_id | daily_revenue | unique_customers | order_count |
|---|---|---|---|---|
| 2024-03-10 | STORE_01 | $365.50 | 4 | 4 (ORD-901, 902, 904, 906) |
| 2024-03-10 | STORE_02 | $660.00 | 3 | 3 (ORD-903, 905, 907) |
Validation Checks & Test Script
Run these verification assertions to prove that all 5 defects have been eradicated.
# 1. Assert Total Revenue matches source sum
total_rev = repaired_df.agg(sum("daily_revenue")).collect()[0][0]
assert float(total_rev) == 1025.50, f"Expected 1025.50, got {total_rev}"
# 2. Assert Order Count matches source clean orders
total_orders = repaired_df.agg(sum("order_count")).collect()[0][0]
assert int(total_orders) == 7, f"Expected 7 orders, got {total_orders}"
# 3. Assert No Duplicate Orders were created by Join
raw_ids = orders_df.select("order_id").distinct().count()
assert repaired_orders_df.count() <= raw_ids, "Join generated duplicate rows!"
print("✓ All validation assertions passed! Pipeline is certified clean.")Evidence To Submit & Root Cause Report
Document your investigation findings using the standard Data Engineering Incident Review format.
Your submission must include the repaired Python code and a structured Root Cause Analysis (RCA) report:
Common Mistakes To Avoid
Learn from these common debugging errors.
Stretch / Bonus Objectives
Automate reconciliation and add regression tests.
Complete DEV-012 to Earn 700 XP & Pipeline Debugger Badge
Diagnose all 5 defects, write the repaired pipeline, pass all validation tests, and submit your Root Cause Analysis report.