
Answer-first summary for fast verification
Answer: The write will fail completely because of the constraint violation and no records will be inserted into the target table.
In Delta Lake, CHECK constraints enforce data integrity at the transaction level. When a batch write operation includes records that violate a CHECK constraint, the entire transaction is aborted (due to ACID guarantees), and no records are inserted. The job fails completely, ensuring only valid data is written. Options A, C, and D describe behaviors (partial writes, quarantine tables, or validity columns) that are not standard features of Delta Lake's constraint enforcement.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A CHECK constraint was successfully added to the Delta table activity_details using the following SQL statement:
ALTER TABLE activity_details
ADD CONSTRAINT valid_coordinates
CHECK (
latitude >= -90 AND
latitude <= 90 AND
longitude >= -180 AND
longitude <= 180
);
ALTER TABLE activity_details
ADD CONSTRAINT valid_coordinates
CHECK (
latitude >= -90 AND
latitude <= 90 AND
longitude >= -180 AND
longitude <= 180
);
A batch job is attempting to insert new records into this table, including one record with latitude = 45.50 and longitude = 212.67.
What will be the result of this batch insert operation?
A
The write will insert all records except those that violate the table constraints; the violating records will be reported in a warning log.
B
The write will fail completely because of the constraint violation and no records will be inserted into the target table.
C
The write will insert all records except those that violate the table constraints; the violating records will be recorded to a quarantine table.
D
The write will include all records in the target table; any violations will be indicated in the boolean column named valid_coordinates.