Databricks Certified Data Engineer Professional · Free Practice Question Medium

Question 1

The data engineering team maintains the following join logic between three Delta tables:



Which statement describes the result of this code block each time it is executed ?

  • A

    All records in the current version of the source tables will be considered in the join operations. The matched records will overwrite the students_courses_details table.

  • B

    All records in the current version of the source tables will be considered in the join operations. The unmatched records will overwrite the students_courses_details table.

  • C

    Only newly added records to any of the source tables will be considered in the join operations. The matched records will overwrite the students_courses_details table.

  • D

    Only newly added records to any of the source tables will be considered in the join operations. The unmatched records will overwrite the students_courses_details table.

  • E

    These join operations are stateful, meaning that they will wait for unmatched records to be added to the source tables prior to calculating the results.

Reveal correct answer

Correct answer: A

Explanation

The query reads three static Delta tables using spark.table() function, which means that all records in the current version of these tables will be read and considered in the join operations.


There is no difference between spark.table() and spark.read.table() function. Actually, spark.read.table() internally calls spark.table().


The pyspark.sql.DataFrame.join() function performs inner join operation by default, so the matched records will be written to the target table. In our case, the query writes the data in mode “overwrite” to the target table, which completely overwrites the table.



Reference:

https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrameReader.table.html

https://spark.apache.org/docs/3.1.2/api/python/reference/api/pyspark.sql.DataFrame.join.html


Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need