Databricks Certified Associate Developer for Apache Spark — Question 140
Which of the following code blocks returns a new DataFrame that is the result of a cross join between DataFrame storesDF and DataFrame employeesDF?
Answer options
- A. storesDF.crossJoin(employeesDF)
- B. storesDF.join(employeesDF, "storeId", "cross")
- C. crossJoin(storesDF, employeesDF)
- D. join(storesDF, employeesDF, "cross")
- E. storesDF.join(employeesDF, "cross")
Correct answer: A
Explanation
The correct answer is A because the method crossJoin is specifically designed to perform a cross join between two DataFrames. Option B is incorrect as it specifies a join condition that does not correspond to a cross join, while options C, D, and E are incorrect because they either use the wrong method or do not follow the correct syntax for DataFrame operations.