Which of the following operations performs a cross join on two DataFrames?
Which of the following operations performs a cross join on two DataFrames?
The correct option is DataFrame.crossJoin(). In PySpark or Apache Spark, the crossJoin() method of the DataFrame class is specifically designed to perform a cross join, which is a Cartesian product of two DataFrames. This means it pairs every row of the first DataFrame with every row of the second DataFrame. Other methods like DataFrame.join(), join(), and DataFrame.merge() do not perform a cross join but are used for different types of SQL joins (like inner join, left join, etc.). The correct option for performing a cross join is DataFrame.crossJoin().
D - https://api-docs.databricks.com/python/pyspark/latest/pyspark.sql/api/pyspark.sql.DataFrame.crossJoin.html
D. DataFrame.crossJoin()