QuestionQ18

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

The code block below has an error. It is intended to return a new DataFrame that results from an outer join between DataFrame storesDF and DataFrame employeesDF on the storeId column. Identify the error.

Code block:

storesDF.join(employeesDF, "storeId")  
Explanation

PySpark SQL DataFrame.join accepts a string as the name of a shared join column, but the how parameter defaults to inner. An outer join therefore requires an explicit join type such as "outer", e.g. storesDF.join(employeesDF, "storeId", "outer").

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!