InterviewStack.io LogoInterviewStack.io

Data Cleaning and Business Logic Edge Cases Questions

Covers handling data centric edge cases and complex business rule interactions in queries and data pipelines. Topics include cleaning and normalizing data, handling nulls and type mismatches, deduplication strategies, treating inconsistent or malformed records, validating results and detecting anomalies, using conditional logic for data transformation, understanding null semantics in SQL, and designing queries that correctly implement date boundaries and domain specific business rules. Emphasis is on producing robust results in the presence of imperfect data and complex requirements.

EasyTechnical
27 practiced
Design a deterministic transformation to canonicalize phone numbers into an E.164-like format for storage given inconsistent source formats: missing country code, leading zeros, extensions, spaces, and punctuation. Describe a Spark or Python implementation, how you would validate numbers, and how you'd handle ambiguous or invalid entries in ETL.
EasyTechnical
23 practiced
You ingest a 'full_name' free-text field from many sources. Describe and implement (SQL or Python pseudocode) a normalization pipeline to: trim leading/trailing whitespace, collapse multiple internal spaces, remove unexpected characters while preserving hyphens/apostrophes, normalize capitalization (respecting common prefixes like Mc/Mac and suffixes), and produce a canonical form for matching. Discuss trade-offs (over-normalization vs preserving legitimate variants) and mention libraries you might use.
MediumTechnical
20 practiced
You need to pick a canonical customer record when duplicates differ across email, phone, source_priority, and last_updated. Write SQL to select one canonical record per customer_id prioritizing source_priority (higher wins) then most recent last_updated. Explain how you would persist provenance (which original record fields contributed) for auditing and later reconciliation.
HardTechnical
23 practiced
During an ID migration old_user_id -> new_user_id mappings are incomplete. Propose a safe approach to reconcile historical events (stored with old_user_id) with modern analytics keyed by new_user_id. Include design for a mapping table, backfill strategies, handling of unmapped events, avoiding double-counting, and performance considerations to avoid full rewrites of large datasets.
MediumTechnical
23 practiced
Describe an end-to-end strategy to deduplicate noisy customer records at scale using Apache Spark. Include: blocking strategies to reduce candidate pairs, choice and implementation of similarity metrics (Jaro-Winkler, Levenshtein, TF-IDF), approximate methods like LSH or MinHash, evaluation metrics (precision/recall), and a pseudocode sketch of a Spark workflow. Also explain threshold tuning and how to produce deterministic outputs for downstream consumers.

Unlock Full Question Bank

Get access to hundreds of Data Cleaning and Business Logic Edge Cases interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.