Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Data Engineer Professional All Questions

View all questions & answers for the Certified Data Engineer Professional exam

Exam Certified Data Engineer Professional topic 1 question 38 discussion

Actual exam question from Databricks's Certified Data Engineer Professional
Question #: 38
Topic #: 1
[All Certified Data Engineer Professional Questions]

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?

  • A. Because another team uses this table to support a frequently running application, two-phase locking is preventing the operation from committing.
  • B. The activity_details table already exists; CHECK constraints can only be added during initial table creation.
  • C. The activity_details table already contains records that violate the constraints; all existing data must pass CHECK constraints in order to add them to an existing table.
  • D. The activity_details table already contains records; CHECK constraints can only be added prior to inserting values into a table.
  • E. The current table schema does not contain the field valid_coordinates; schema evolution will need to be enabled before altering the table to add a constraint.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
8605246
Highly Voted 1 year, 3 months ago
incorrect the correct option is C, with constraints, if added to an existing table the existing data in the table must be consistent with the constraint otherwise it fails https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html#add-constraint
upvoted 12 times
...
AndreFR
Most Recent 3 months ago
Selected Answer: C
-- 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);
upvoted 1 times
...
faraaz132
3 months, 3 weeks ago
Selected Answer: C
C is correct.
upvoted 1 times
...
PrashantTiwari
9 months, 2 weeks ago
C is correct
upvoted 1 times
...
DAN_H
9 months, 3 weeks ago
correct ans is C
upvoted 1 times
...
AziLa
10 months ago
correct ans is C
upvoted 1 times
...
Jay_98_11
10 months, 2 weeks ago
Selected Answer: C
correct
upvoted 1 times
...
kz_data
10 months, 2 weeks ago
Selected Answer: C
C is the correct answer
upvoted 1 times
...
Patito
11 months ago
Selected Answer: C
C is correct
upvoted 1 times
...
hamzaKhribi
11 months, 4 weeks ago
Selected Answer: C
C is correct
upvoted 1 times
...
Enduresoul
1 year ago
Selected Answer: C
C is correct
upvoted 1 times
...
aragorn_brego
1 year ago
Selected Answer: C
When adding a CHECK constraint to an existing table, the operation will fail if there are any rows in the table that do not meet the constraint. Before a CHECK constraint can be added, the data already in the table must be validated to ensure that it complies with the constraint conditions. If any existing records violate the new constraints, they must be corrected or removed before the ALTER TABLE command can be successfully executed.
upvoted 2 times
...
BIKRAM063
1 year ago
Selected Answer: C
Correct option C : existing data violated check constraint condition
upvoted 1 times
...
Quadronoid
1 year ago
Selected Answer: C
Right answer is C
upvoted 1 times
...
sturcu
1 year, 1 month ago
Selected Answer: C
C - table already has data
upvoted 1 times
...
MarceloManhaes
1 year, 2 months ago
Yes the correct is option C
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...