The downstream consumers of a Delta Lake table have been complaining about data quality issues impacting performance in their applications. Specifically, they have complained that invalid latitude and longitude values in the activity_details table have been breaking their ability to use other geolocation processes. A junior engineer has written the following code to add CHECK constraints to the Delta Lake table: A senior engineer has confirmed the above logic is correct and the valid ranges for latitude and longitude are provided, but the code fails when executed. Which statement explains the cause of this failure?
Select one answer.
Marked answer: C
Community Discussion
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
Chose C1
suretly C
Chose C1
-- CREATE TABLE create table test_constraint (t1 varchar(2), n1 int); -- ADD VALUE insert into test_constraint values ('v3', 3); -- ADD CONSTAINT VIOLATED BY CURRENT DATA -- should throw error : 1 row in spark_catalog.default.test_constaint violate the new CHECK constraint (n1 < 3) alter table test_constraint add constraint valid_n1 check (n1 < 3); -- ADD CONSTAINT NOT VIOLATED BY CURRENT DATA (no error) alter table test_constraint add constraint valid_n1 check (n1 < 100);