The Bad Row That Broke the Dashboard

A medium Pipeline Design interview practice problem on DataDriven. Design the pipeline on the canvas: sources, transforms, storage and checks, then get feedback on it.

Domain
Pipeline Design
Difficulty
medium
Seniority
L6

Problem

The application event stream carries about 50,000 events per second at peak from 40 producer services, each publishing against a registered schema contract, and every event lands in Snowflake for analytics. Design the streaming pipeline that enforces those contracts at the source.

Bad records cannot reach the warehouse.

Business requirements

Worked solution and explanation

Why this problem exists in real interviews

Streaming quality enforcement with four properties that have to fit together: validation before promotion, recoverable rejection so engineering can replay, sub-minute end-to-end, and a producer contract that catches schema changes upstream. The trap is letting bad records through 'just to keep the pipeline moving' or letting validation block all events on a single bad row.

The default reach is a streaming load that writes everything and 'fixes' bad rows in a downstream cleanup. The first malformed event corrupts a dashboard; the team adds a parser fix; another field changes a week later and the same thing happens. Rejected records get logged to a file nobody reads. Producers ship a breaking schema change because the wiki page about discipline didn't catch it.


Walk the requirements

Step 1: Validate before promotion; bad records never reach the warehouse

An in-stream quality gate runs schema, type, and business-rule checks on each record before the warehouse load. Records that pass write to the production table; records that fail route to a rejection store with the failure reason. Dashboards read only from validated rows. Without a quality-check tier the validation has no place to live; without a streaming tier the validation can't keep up with sub-minute events.

Step 2: Rejected records stay recoverable for replay

Each rejection writes the original payload and the failure reason to a rejection store keyed on event id and timestamp. Engineering queries the store to find rejected records, traces the root cause (parser bug, producer change, business-rule mismatch), fixes upstream, and replays the affected events back through the pipeline. Logging rejections to a file is the version where they disappear into ops; the rejection store is what makes recovery a workflow.

Step 3: Sub-minute end-to-end including validation

Events flow through a streaming consumer, the validator, and into the warehouse within the minute. The validator is part of the streaming path, not a downstream batch; the warehouse load reads only validated rows. A 'load first, validate later' design is the version where bad data is briefly in production and downstream consumers see it. In-stream validation is what closes the gap.

Step 4: Schema contract at the bus catches producer changes at publish

Product teams add and remove fields weekly. The bus's schema-contract layer rejects publishes that don't conform to the contract; producers find out at publish time, not when consumers crash at midnight. An additive change (new optional field) is allowed through compatibility rules; a breaking change is rejected. Without the contract every producer release is a coordination tax on every consumer.


The shape that fits

In-stream validation gates the warehouse load; rejections preserve the payload and failure reason for replay; the schema contract catches producer changes at publish.
  • producers (source, Kafka)
  • schema_contract (quality gate, custom)
  • event_bus (queue, Kafka)
  • streaming_validator (transform, Flink)
  • quality_gate (quality gate, Great Expectations)
  • rejection_store (storage, object storage)
  • analytics_warehouse (storage, Snowflake)
  • analytics_team (consumer, dashboard)
  • engineering_replay (consumer, API)
  • producers -> schema_contract
  • schema_contract -> event_bus
  • event_bus -> streaming_validator
  • streaming_validator -> quality_gate
  • quality_gate -> analytics_warehouse
  • quality_gate -> rejection_store
  • analytics_warehouse -> analytics_team
  • rejection_store -> engineering_replay
  • Producers + contract: producers, schema_contract
  • Bus + validator: event_bus, streaming_validator, quality_gate
  • Warehouse + rejection: analytics_warehouse, rejection_store
  • Consumers: analytics_team, engineering_replay

Common follow-up questions