nerdexam
Databricks

CERTIFIED-DATA-ENGINEER-PROFESSIONAL · Question #27

A junior data engineer on your team has implemented the following code block. The view new_events contains a batch of records with the same schema as the events Delta table. The event_id field…

The correct answer is B. They are ignored. The code block (not fully shown) uses a MERGE statement that only includes a WHEN NOT MATCHED THEN INSERT clause - there is no WHEN MATCHED clause. In Delta Lake MERGE operations, if no WHEN MATCHED clause is defined, source records that find a match in the target table are…

Data Manipulation with Delta Lake

Question

A junior data engineer on your team has implemented the following code block. The view new_events contains a batch of records with the same schema as the events Delta table. The event_id field serves as a unique key for this table. When this query is executed, what will happen with new records that have the same event_id as an existing record?

Options

  • AThey are merged.
  • BThey are ignored.
  • CThey are updated.
  • DThey are inserted.
  • EThey are deleted.

How the community answered

(56 responses)
  • B
    95% (53)
  • C
    2% (1)
  • E
    4% (2)

Explanation

The code block (not fully shown) uses a MERGE statement that only includes a WHEN NOT MATCHED THEN INSERT clause - there is no WHEN MATCHED clause. In Delta Lake MERGE operations, if no WHEN MATCHED clause is defined, source records that find a match in the target table are silently skipped (ignored). They are neither updated, deleted, nor inserted again. Only records in the source that do NOT have a matching key in the target are inserted. This is a common pattern for idempotent 'insert-if-not-exists' logic, and the result for duplicates is that they are ignored.

Topics

#Delta Lake#MERGE Statement#Duplicate Handling#Data Ingestion

Community Discussion

No community discussion yet for this question.

Full CERTIFIED-DATA-ENGINEER-PROFESSIONAL Practice