Skip to content

Finding and fixing duplicates, missing values, and nulls

In Azure Databricks, data engineers use Apache Spark DataFrame APIs and SQL functions to detect and resolve duplicate, missing, and null values as part of building reliable ETL pipelines, typically within Delta Lake tables. Common techniques include dropDuplicates(), fillna()/coalesce(), dropna(), and constraint enforcement, often applied in the Bronze-to-Silver transformation stage of a medallion architecture. Choosing the right resolution strategy (drop, impute, or flag) depends on business requirements and data lineage needs.

1 · Learn the must-know

  • dropDuplicates() removes exact duplicate rows across all columns by default, but you can pass a subset of column names to define duplicates based on specific keys only.
  • isNull()/isNotNull() and the SQL IS NULL/IS NOT NULL predicates are the standard way to filter or count null values; comparing with = NULL always returns null (falsy), not true.
  • na.fill() (or fillna()) lets you replace nulls with a specified value per column or globally, while na.drop() (or dropna()) removes rows based on 'any' or 'all' null conditions across specified columns.
  • coalesce() returns the first non-null value from a list of columns, making it useful for consolidating data from multiple overlapping source columns.
  • Delta Lake table constraints (NOT NULL and CHECK) can proactively prevent null or invalid values from being written, enforcing data quality at write time rather than relying solely on downstream cleansing.
  • When deduplicating streaming or incrementally loaded data, window functions (row_number() over a partition ordered by a timestamp) are commonly used to identify and keep only the most recent record per key, which dropDuplicates() alone cannot guarantee correctly.

2 · Check your understanding

Check this objectiveFree · always available

A data engineer ingests customer order data into a Delta table. Due to a retried ingestion job, some rows are exact duplicates across every column, while other rows share the same order_id but have slightly different processing timestamps because the same order was captured twice by separate upstream systems. The engineer only wants to remove rows that share the same order_id, keeping the first occurrence of each. Which code accomplishes this?

Your objective map0 tried · 0 answered correctly · 77 untouched

What you have tried across DP-750's objectives, not a readiness score.

Set up and configure an Azure Databricks environment15-20% of the exam0 of 13 tried
Secure and govern Unity Catalog objects15-20% of the exam0 of 12 tried
Prepare and process data30-35% of the exam0 of 28 tried
Deploy and maintain data pipelines and workloads30-35% of the exam0 of 24 tried

3 · Keep going