nerdexam
Databricks

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…

DataFrame Operations and SQL Joins in Apache Spark

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
    1. join
  • B
    1. join
  • C
    1. merge
  • D
    1. join
  • E
    1. join

How the community answered

(47 responses)
  • A
    2% (1)
  • B
    6% (3)
  • C
    4% (2)
  • D
    87% (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 join but 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

#DataFrame Joins#Spark SQL#Transformations#Join Syntax

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Practice