Problem Scenario 64 : You have been given below code snippet.
val a = sc.parallelize(List("dog", "salmon", "salmon", "rat", "elephant"), 3)
val b = a.keyBy(_.length)
val c = sc.parallelize(Ust("dog", "cat", "gnu", "salmon", "rabbit", "turkey", "wolf", "bear", "bee"), 3)
val d = c.keyBy(_.length)
operation1
Write a correct code snippet for operationl which will produce desired output, shown below.
Array[(lnt, (Option[String], String))] = Array((6, (Some(salmon), salmon)), (6, (Some(salmon), rabbit}}, (6, (Some(salmon), turkey)), (6, (Some(salmon), salmon)), (6, (Some(salmon), rabbit)), (6, (Some(salmon), turkey)), (3, (Some(dog), dog)), (3, (Some(dog), cat)), (3, (Some(dog), gnu)), (3, (Some(dog), bee)), (3, (Some(rat), (3, (Some(rat), cat)), (3, (Some(rat), gnu)), (3, (Some(rat), bee)), (4, (None, wo!f)), (4, (None, bear)))
- See the explanation for Step by Step Solution and configuration.
Answer(s): A
Explanation:
Solution : b.rightOuterJqin(d).collect
rightOuterJoin [Pair] : Performs an right outer join using two key-value RDDs. Please note that the keys must be generally comparable to make this work correctly.
Reveal Solution
Next Question