title: Join on RDD and map the values - constructor cannot be instantiated to expected type
body: <p>I'm new to the world of Scala and Spark and hence need a little help.</p>
  
  <p>I've two vals, both - <code>RDD[((String, String), Double)]</code></p>
  
  <p>and the values like:-</p>
  
  <pre><code>RDD1 = 
  ((a, b), 10)
  ((c, d), 20)
  ((g, h),50)
  
  RDD2 = 
  ((a, b), 20)
  ((e, f), 30)
  ((g, h), 10)
  </code></pre>
  
  <p>and the desired output is:-</p>
  
  <pre><code>(a, b, 30)
  (c, d, 20)
  (e, f, 30)
  (g, h, 60)
  </code></pre>
  
  <p>I'm sorry for posting the mock data due to some policies, but would really appreciate any help.</p>
  
  <p>I tried:-</p>
  
  <pre><code>    val joined = rdd1.fullOuterJoin(rdd2).map{case(x, y, z) =&gt; (x._1, x._2, y+z)}
  
  but seems I'm making some mistake. It shows error that:-
  [error] ...../class.scala:59: constructor cannot be instantiated to expected type;
  [error]  found   : (T1, T2, T3)
  [error]  required: ((String, String), (Option[Double], Option[Double]))
  [error]       val joined = rdd1.fullOuterJoin(rdd2).map{case(x, y, z) =&gt; (x._1, x._2, y._1+z._1)}
  [error]                                                                    ^
  [error] ...../class.scala:59: not found: value x
  [error]       val joined = rdd1.fullOuterJoin(rdd2).map{case(x, y, z) =&gt; (x._1, x._2, y._1+z._1)}
  [error]                                                                                  ^
  [error] ...../class.scala:59: not found: value x
  [error]       val joined = rdd1.fullOuterJoin(rdd2).map{case(x, y, z) =&gt; (x._1, x._2, y._1+z._1)}
  [error]                                                                                        ^
  [error] ...../class.scala:59: not found: value y
  [error]       val joined = rdd1.fullOuterJoin(rdd2).map{case(x, y, z) =&gt; (x._1, x._2, y._1+z._1)}
  [error]                                                                                              ^
  [error] four errors found
  [error] (compile:compileIncremental) Compilation failed
  [error] Total time: 3 s, completed 25 Jul, 2018 6:54:09 PM
  </code></pre>
  
  <p>Any help will be appreciated</p>