nerdexam
Databricks

CERTIFIED-DATA-ENGINEER-PROFESSIONAL · Question #84

A Delta Lake table in the Lakehouse named customer_parsams is used in churn prediction by the machine learning team. The table contains information about customers derived from a number of upstream…

The correct answer is C. Execute a query to calculate the difference between the new version and the previous version. Delta Lake automatically maintains a versioned transaction log for every table operation. After an overwrite, the new version is version N and the previous is version N-1. Delta's time travel feature lets you query any prior version using VERSION AS OF syntax. You can therefore…

Managing Delta Lake Tables

Question

A Delta Lake table in the Lakehouse named customer_parsams is used in churn prediction by the machine learning team. The table contains information about customers derived from a number of upstream sources. Currently, the data engineering team populates this table nightly by overwriting the table with the current valid values derived from upstream data sources. Immediately after each update succeeds, the data engineer team would like to determine the difference between the new version and the previous of the table. Given the current implementation, which method can be used?

Options

  • AParse the Delta Lake transaction log to identify all newly written data files.
  • BExecute DESCRIBE HISTORY customer_churn_params to obtain the full operation metrics for
  • CExecute a query to calculate the difference between the new version and the previous version
  • DParse the Spark event logs to identify those rows that were updated, inserted, or deleted.

How the community answered

(41 responses)
  • A
    5% (2)
  • B
    2% (1)
  • C
    80% (33)
  • D
    12% (5)

Explanation

Delta Lake automatically maintains a versioned transaction log for every table operation. After an overwrite, the new version is version N and the previous is version N-1. Delta's time travel feature lets you query any prior version using VERSION AS OF syntax. You can therefore execute a query that compares SELECT * FROM customer_parsams VERSION AS OF N against SELECT * FROM customer_parsams VERSION AS OF N-1 using set operations (EXCEPT, UNION, etc.) to compute the exact diff. Option A (parsing raw transaction log files) is error-prone and unnecessary given built-in SQL support. Option B references DESCRIBE HISTORY, which gives operation-level metadata and row counts but not row-level diffs. Option D (Spark event logs) captures execution details, not row-level data changes.

Topics

#Delta Lake#Time Travel#SQL Queries#Data Versioning

Community Discussion

No community discussion yet for this question.

Full CERTIFIED-DATA-ENGINEER-PROFESSIONAL Practice