Spark Intersection FunctionIn Spark, Intersection function returns a new dataset that contains the intersection of elements present in the different datasets. So, it returns only a single row. This function behaves just like the INTERSECT query in SQL. Example of Intersection functionIn this example, we intersect the elements of two datasets.
![]()
![]()
![]()
![]() Here, we got the desired output.
Next TopicSpark Cartesian Function
|