DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #62
The code block shown below should return a new DataFrame that is the result of an inner join between DataFrame storeDF and DataFrame employeesDF on column storeId. Choose the response chat correctly…
The correct answer is D. 1. join. Option D correctly completes the PySpark DataFrame join with 1. join, 2. employeesDF, 3. "storeId", 4. "inner" - matching the PySpark API signature df.join(other, on, how) where you pass the other DataFrame first, then the join key, then the join type. Why distractors are…
Question
The code block shown below should return a new DataFrame that is the result of an inner join between DataFrame storeDF and DataFrame employeesDF on column storeId. Choose the response chat correctly fills in the numbered blanks within the code block to complete this task. Code block:
storesDF.1(2, 3, 4)
Options
- A
- join
- B
- join
- C
- merge
- D
- join
- E
- join
How the community answered
(47 responses)- A2% (1)
- B6% (3)
- C4% (2)
- D87% (41)
Explanation
Option D correctly completes the PySpark DataFrame join with 1. join, 2. employeesDF, 3. "storeId", 4. "inner" - matching the PySpark API signature df.join(other, on, how) where you pass the other DataFrame first, then the join key, then the join type.
Why distractors are wrong:
- C uses
merge- that's the pandas API, not PySpark's DataFrame API. PySpark DataFrames use.join(), not.merge(). - A, B, E also use
joinbut get the parameter order or values wrong - common traps include swapping the column name and join type, using"storeId"as blank 2 (before the DataFrame), or omitting/misspelling"inner"as the join strategy.
Memory tip: Think of PySpark's .join() arguments as answering three questions in order - "Join with WHO? On WHAT column? In WHAT way?" → (employeesDF, "storeId", "inner"). If you remember pandas uses merge and PySpark uses join, you can immediately eliminate any option that crosses the two APIs.
Topics
Community Discussion
No community discussion yet for this question.