PracHub
QuestionsLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Cognitiv

Reason About Duplicate Data and Scaling in Spark

Last updated: Aug 5, 2026

Quick Overview

Explain how to define and remove duplicate data in Spark, then scale the pipeline as volume and traffic increase. Candidates must translate business identity into deterministic batch or streaming operations while addressing shuffles, skew, state retention, late data, retries, idempotent sinks, backfills, tuning, and observability.

  • hard
  • Cognitiv
  • Software Engineering Fundamentals
  • Software Engineer

Reason About Duplicate Data and Scaling in Spark

Company: Cognitiv

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Technical Screen

## Reason About Duplicate Data and Scaling in Spark In a technical experience discussion, explain how you would identify and handle duplicate data in a Spark pipeline and how you would scale the pipeline as data volume and traffic grow. No schema, latency target, or duplicate definition is supplied, so make those assumptions explicit before choosing operations. ### Part 1 — Define Duplicate Semantics Distinguish exact duplicate rows from repeated events, retried deliveries, and different records that share a business key. Define which copy should survive and for how long deduplication state must be retained. #### What This Part Should Cover - A stable event ID or a documented composite business key. - Full-row, key-only, and key-plus-time duplicate definitions. - A deterministic survivor rule for conflicting copies. - Batch versus streaming scope, late arrival, and replay semantics. ```hint Define identity before removing rows Two records that compare equal in one column are not necessarily the same event, while byte-identical retries may still need one logical outcome. ``` ### Part 2 — Design the Spark Processing Plan Describe the transformations, partitioning, and state needed for the chosen batch or streaming contract. Address shuffle cost, skew, and deterministic results. #### What This Part Should Cover - Schema validation and normalization before computing keys. - An exact operation plan, such as key-based aggregation, window ranking, or bounded streaming deduplication. - Partition keys and shuffle behavior for large or highly skewed keys. - Checkpoint, watermark, or state-retention behavior where streaming is used. ```hint Choose the survivor explicitly A deduplication job is incomplete until ties are resolved by a stable ordering rather than by whichever partition finishes first. ``` ### Part 3 — Scale and Operate the Pipeline Explain how the design evolves from a small batch job to sustained large-scale processing. Include retries, idempotent output, backfills, resource tuning, and observability. #### What This Part Should Cover - Incremental reads and partition pruning instead of rescanning all history. - File sizing, parallelism, memory pressure, shuffle spill, and skew mitigation. - Idempotent or transactional sink behavior under task and job retries. - A backfill plan that does not corrupt live output. - Metrics for input/output counts, duplicate rate, lag, state size, skew, spill, and failures. ```hint Scale the data movement first More executors do not fix a plan that rereads all history, sends one hot key to one task, or rewrites the same output on every retry. ``` ### What a Strong Answer Covers - A business-level duplicate definition translated into deterministic Spark operations. - Correct batch or streaming state boundaries and late-data behavior. - Explicit shuffle, partitioning, skew, and retry semantics. - Reproducible backfills, idempotent output, and measurements that reveal both correctness and performance drift. ### Follow-up Questions 1. How would you choose a watermark when duplicates can arrive days late? 2. What should happen when two records share an event ID but disagree on payload? 3. How would you diagnose one key that dominates a shuffle partition? 4. How would you prove that rerunning a failed partition does not duplicate sink output?

Quick Answer: Explain how to define and remove duplicate data in Spark, then scale the pipeline as volume and traffic increase. Candidates must translate business identity into deterministic batch or streaming operations while addressing shuffles, skew, state retention, late data, retries, idempotent sinks, backfills, tuning, and observability.

|Home/Software Engineering Fundamentals/Cognitiv

Reason About Duplicate Data and Scaling in Spark

Cognitiv logo
Cognitiv
Jul 28, 2026, 12:00 AM
hardSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
0
0

Reason About Duplicate Data and Scaling in Spark

In a technical experience discussion, explain how you would identify and handle duplicate data in a Spark pipeline and how you would scale the pipeline as data volume and traffic grow. No schema, latency target, or duplicate definition is supplied, so make those assumptions explicit before choosing operations.

Part 1 — Define Duplicate Semantics

Distinguish exact duplicate rows from repeated events, retried deliveries, and different records that share a business key. Define which copy should survive and for how long deduplication state must be retained.

What This Part Should Cover Guidance

  • A stable event ID or a documented composite business key.
  • Full-row, key-only, and key-plus-time duplicate definitions.
  • A deterministic survivor rule for conflicting copies.
  • Batch versus streaming scope, late arrival, and replay semantics.

Part 2 — Design the Spark Processing Plan

Describe the transformations, partitioning, and state needed for the chosen batch or streaming contract. Address shuffle cost, skew, and deterministic results.

What This Part Should Cover Guidance

  • Schema validation and normalization before computing keys.
  • An exact operation plan, such as key-based aggregation, window ranking, or bounded streaming deduplication.
  • Partition keys and shuffle behavior for large or highly skewed keys.
  • Checkpoint, watermark, or state-retention behavior where streaming is used.

Part 3 — Scale and Operate the Pipeline

Explain how the design evolves from a small batch job to sustained large-scale processing. Include retries, idempotent output, backfills, resource tuning, and observability.

What This Part Should Cover Guidance

  • Incremental reads and partition pruning instead of rescanning all history.
  • File sizing, parallelism, memory pressure, shuffle spill, and skew mitigation.
  • Idempotent or transactional sink behavior under task and job retries.
  • A backfill plan that does not corrupt live output.
  • Metrics for input/output counts, duplicate rate, lag, state size, skew, spill, and failures.

What a Strong Answer Covers Guidance

  • A business-level duplicate definition translated into deterministic Spark operations.
  • Correct batch or streaming state boundaries and late-data behavior.
  • Explicit shuffle, partitioning, skew, and retry semantics.
  • Reproducible backfills, idempotent output, and measurements that reveal both correctness and performance drift.

Follow-up Questions Guidance

  1. How would you choose a watermark when duplicates can arrive days late?
  2. What should happen when two records share an event ID but disagree on payload?
  3. How would you diagnose one key that dominates a shuffle partition?
  4. How would you prove that rerunning a failed partition does not duplicate sink output?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Cognitiv•More Software Engineer•Cognitiv Software Engineer•Cognitiv Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.