title: How to use ReduceByKey on multiple key in a Scala Spark Job
body: <p>I'm relatively new to spark and I'm trying to group data by multiple keys at the same time.</p>
  
  <p>I have some data that I map so it ends up looking like this:</p>
  
  <p>((K1,K2,K3),(V1,V2))</p>
  
  <p>My goal is to group by (K1,K2,K3) and respectively sum V1 and V2 to end up with:</p>
  
  <p>((K1,K2,K3), (SUM(V1),SUM(V2))</p>
  
  <p>Here is the code I have so far:</p>
  
  <pre><code>val filepath  = "file.avro"
  val sc = new SparkContext(sparkConf)
  val sqlContext = new SQLContext(sc)            
  val data = sqlContext.read.avro(filepath)
  val dataRDD = data.rdd
  
  val mappedDataRDD = dataRDD.map{
     case (v, w, x, y, z) =&gt; ((v,w,x), (y, z))
  }.reduceByKey((x,y)=&gt; ???)
  </code></pre>
  
  <p>So I'm looking for how to reduceByKey so I can group by the (v,w,x) keys and sum the y and z.</p>