Spark Union Function
In Spark, Union capacity returns a new dataset that contains the mix of components present in the different datasets.
Example of Union function
In this model, we consolidate the components of two datasets.
$ spark-shell
scala> val data1 = sc.parallelize(List(1,2>
>
scala> data1.collect
Create another RDD using parallelized collection.
scala> val data2 = sc.parallelize(List(3,4,5>
>
scala> data2.collect
capacity to return the association of the components.
scala> val unionfunc = data1.union(data2>
Presently, we can peruse the created outcome by utilizing the accompanying order.
scala> unionfunc.collect