Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 51


The code block shown below contains an error. The code block intended to return a new DataFrame that is the result of an inner join between DataFrame storesDF and DataFrame employeesDF on column storeId. Identify the error.

Code block:

StoresDF.join(employeesDF, "inner", "storeID")

Show Answer
Correct Answer: E

The join function syntax in DataFrame operations expects the column key as the second parameter and the type of join as the third parameter. In this case, the correct call should be storesDF.join(employeesDF, "storeID", "inner") instead of the given storesDF.join(employeesDF, "inner", "storeID"). Switching the second and third arguments will correct this error.

Discussion

2 comments
Sign in to comment
JticOption: E
May 29, 2023

E storesDF.join(employeesDF, "storeID", "inner") The column key is the second parameter to join() and the type of join is in the third parameter to join() – the second and third arguments should be switched

newusernameOption: E
Nov 7, 2023

there are diff methods to join dataframes, one of the: joinedDF = StoresDF.join(employeesDF, "storeId", "inner")