QuestionQ67

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

The code block below has an error. It is intended to return a new DataFrame resulting from a cross join between DataFrame storesDF and DataFrame employeesDF. Identify the error.

Code block:

storesDF.join(employeesDF, "cross")  
Explanation

The second positional parameter of DataFrame.join() is the join condition or column name, so the string "cross" is treated as a join key rather than as a cross-join instruction. DataFrame.crossJoin(other) explicitly returns the Cartesian product of two DataFrames.

Learn more

Community Discussion

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