LeetQuiz Logo
Privacy Policy•contact@leetquiz.com
© 2025 LeetQuiz All rights reserved.
Databricks Certified Data Engineer - Professional

Databricks Certified Data Engineer - Professional

Get started today

Ultimate access to all questions.


Downstream consumers of a Delta Lake table are reporting data quality issues affecting their application performance, particularly due to invalid latitude and longitude values in the activity_details table. A junior engineer attempted to add CHECK constraints with the following code, which fails despite correct logic for valid coordinate ranges (-90 to 90 for latitude, -180 to 180 for longitude):

ALTER TABLE activity_details
ADD CONSTRAINT valid_coordinates
CHECK (
    latitude >= -90 AND
    latitude <= 90 AND
    longitude >= -180 AND
    longitude <= 180
);

What is the reason for this execution failure?

Exam-Like




Explanation:

The ALTER TABLE ADD CONSTRAINT command in Delta Lake requires that all existing data in the table must comply with the new CHECK constraint. If any existing records violate the constraint (e.g., invalid latitude or longitude values outside the specified ranges), the operation will fail. The error occurs because constraints are enforced on both existing and future data. The correct explanation is that existing data violates the constraints, making option C the correct answer. Other options like B and D incorrectly suggest constraints can only be added at table creation or before data insertion, which is not true. A and E are unrelated to the data validation issue described.

Powered ByGPT-5