Databricks Certified Data Engineer Associate — Question 42
A dataset has been defined using Delta Live Tables and includes an expectations clause:
CONSTRAINT valid_timestamp EXPECT (timestamp > '2020-01-01') ON VIOLATION FAIL UPDATE
What is the expected behavior when a batch of data containing data that violates these constraints is processed?
Answer options
- A. Records that violate the expectation are dropped from the target dataset and recorded as invalid in the event log.
- B. Records that violate the expectation cause the job to fail.
- C. Records that violate the expectation are dropped from the target dataset and loaded into a quarantine table.
- D. Records that violate the expectation are added to the target dataset and recorded as invalid in the event log.
- E. Records that violate the expectation are added to the target dataset and flagged as invalid in a field added to the target dataset.
Correct answer: B
Explanation
The correct answer is B because when the expectation is set to FAIL ON VIOLATION, any data that violates the constraint will trigger a failure of the job, preventing the invalid records from being processed. The other options suggest that the records are either dropped or added to the dataset, which contradicts the specified behavior of failing the job upon violation.