Hey,
Yes, there are two ways of doing this you can follow this example provided below.
Lets us take a new set first:
scala> var s1=Set(7,9,8,9)
s1: scala.collection.immutable.Set[Int] = Set(7, 9, 8)
scala> s++s1
res3: scala.collection.immutable.Set[Int] = Set(1, 9, 7, 3, 8, 4)
scala> s++s1
res4: scala.collection.immutable.Set[Int] = Set(1, 9, 7, 3, 8, 4)
scala> s1++s
res5: scala.collection.immutable.Set[Int] = Set(1, 9, 7, 3, 8, 4)
You can call the ++() method to either set and pass the other to it.
scala> s.++(s1)
res6: scala.collection.immutable.Set[Int] = Set(1, 9, 7, 3, 8, 4)
scala> s1.++(s)
res7: scala.collection.immutable.Set[Int] = Set(1, 9, 7, 3, 8, 4)
If you want to know more about Apache Spark Scala, It's highly recommended to go for the Spark Certification Course today.