Skip to content
Tech Interview Prep
Technical interview guide

Data Quality & Validation

Catching bad data before it reaches downstream consumers: schema checks, freshness, and anomaly detection.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Great Expectations, dbt, Deequ, OpenLineage 1.53, JSON Schema 2020-12, and OpenAPI current 2026-08-31.

Overview

Curated: · Written: · Reviewed:

Data Quality & Validation

In one line

Validation checks that one dataset version is fit for a named decision before consumers read it, using producer contracts, grain-level rules, reconciliation, freshness and segmented anomaly detection. Reach for it at each boundary where bad data can be stopped cheaply, and say what each check does not prove.

Key definitions

  • Expectation: a named, parameterized assertion bound to a batch, returning success, observed value and unexpected count.
  • Grain: the key one row represents. Uniqueness is tested on it, including validity columns for Type-2 dimensions.
  • Business-time freshness: lag between the newest event time in the table and now, not last_modified.
  • Control total: row count and sum reconciled between source and target, segmented by key dimensions.
  • Severity: the policy outcome (warn, quarantine, block) layered on top of the recorded pass or fail.
  • Analyzer and constraint (Deequ): an analyzer computes a metric; a constraint is a predicate over it.

Formulas and complexity

null rate=#{rows where x is null}N\text{null rate} = \frac{\#\{\text{rows where } x \text{ is null}\}}{N} false negative rate=invalid rows not flaggedinvalid rows\text{false negative rate} = \frac{\text{invalid rows not flagged}}{\text{invalid rows}} z=x−μsegmentσsegmentz = \frac{x - \mu_{\text{segment}}}{\sigma_{\text{segment}}}

Worked check: 400 truly invalid rows, 350 flagged, 300 of the flags true. Missed rows are 400 - 300 = 100, so the false negative rate is 100/400 = 25%.

How it works

pass warn quarantine block Producer contract check Dataset and grain rules Reconciliation and freshness Policy Publish version Publish, warning recorded Hold bad rows, publish rest Stop, prior version stays current
  1. Structural checks (JSON Schema 2020-12, OpenAPI Schema Objects, Avro) reject malformed producer output at the boundary.
  2. Dataset rules test populations, grain uniqueness, referential coverage and control totals before publish.
  3. Freshness is read from the newest business timestamp against the expected interval, separately from completeness.
  4. Each result is recorded with dataset version, partition, source position and rule version. Policy then picks warn, quarantine or block.
  5. Publish evidence with the version it validated. Never mark a newer version current while validating an older one.

When to use and when not to

CheckUse it whenBlind spot
Generic test (not_null, unique)Cheap cover at the declared grainUnique with NULLs excluded hides unresolved duplicate keys
Singular SQL testA cross-table invariantCovers only the slice it scans
Control-total reconciliationSource and target both availableEqual totals can hide offsetting segment errors
Static thresholdA fixed contract or impossible stateMis-baselined on weekday, season or tenant patterns
Segmented anomalyVolume or rate drift against historyEvidence to investigate, not proof of bad data
SamplingCost-capped checks on large tablesMisses rare defects, such as 1-in-100,000 duplicates

Traps interviewers probe

  1. Reading one green test as coverage. Fix: name the population it scanned (yesterday's partition, one column) and call the rest untested.
  2. Testing uniqueness on one column when the grain is composite. Fix: test (customer_id, valid_from). Duplicates that differ only in valid_from are a grain question, not a dedupe.
  3. Trusting equal grand totals. Fix: segment by region and key. EU at +$2M and APAC at -$2M net to zero, and a dropped row cancels a duplicate of the same amount.
  4. Treating warn as hold. Fix: warn publishes the failing rows. dbt warn does not remove rows from downstream models. Use quarantine or block when those rows must stay out.
  5. Editing a rule in place. Fix: version the rule and store raw measurements. Moving a limit from 5% to 2% in place changes 30 of 31 stored pass/fail outcomes without touching any data.

Interview tips

Open with the decision: validation is a control at a boundary, tied to a decision. Before picking tests I fix grain, population, threshold, severity, owner and action.

Follow-ups to expect:

  • How a unique test handles NULL keys. Count NULLs as unresolved identities, not as passes.
  • How to baseline volume without paging on Mondays. Segment by weekday, tenant and hour-of-week.
  • Inner join versus orphans. Run referential coverage before publish and handle late-arriving parents explicitly, instead of letting the join drop rows.
  • Freshness. Page on event-time lag. A last_modified of 09:59:50 hides a newest event at 09:52:10, which is 470 s behind at 10:00:00.
  • Validating a backfill. Reconcile the restated version against source totals per segment before it becomes current.

30-second answer outline:

  1. Decision and grain.
  2. Layers: contract at ingest, grain rules, reconciliation, business-time freshness.
  3. Segmented anomaly checks on history for volume and rates.
  4. Severity by consequence, with quarantine and replay for failures.
  5. What it does not prove: a green suite is not correctness, so reconcile against an independent oracle periodically.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.